Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: Source/core/dom/DatasetDOMStringMap.cpp

Issue 63223002: Handle (numeric) indexed access of DOMStringMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add tests for array index-like properties Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/DOMStringMap.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (!attributeName.startsWith("data-")) 76 if (!attributeName.startsWith("data-"))
77 return false; 77 return false;
78 78
79 unsigned propertyLength = propertyName.length(); 79 unsigned propertyLength = propertyName.length();
80 unsigned attributeLength = attributeName.length(); 80 unsigned attributeLength = attributeName.length();
81 81
82 unsigned a = 5; 82 unsigned a = 5;
83 unsigned p = 0; 83 unsigned p = 0;
84 bool wordBoundary = false; 84 bool wordBoundary = false;
85 while (a < attributeLength && p < propertyLength) { 85 while (a < attributeLength && p < propertyLength) {
86 if (attributeName[a] == '-' && a + 1 < attributeLength && attributeName[ a + 1] != '-') 86 if (attributeName[a] == '-' && a + 1 < attributeLength && isASCIILower(a ttributeName[a + 1]))
87 wordBoundary = true; 87 wordBoundary = true;
88 else { 88 else {
89 if ((wordBoundary ? toASCIIUpper(attributeName[a]) : attributeName[a ]) != propertyName[p]) 89 if ((wordBoundary ? toASCIIUpper(attributeName[a]) : attributeName[a ]) != propertyName[p])
90 return false; 90 return false;
91 p++; 91 p++;
92 wordBoundary = false; 92 wordBoundary = false;
93 } 93 }
94 a++; 94 a++;
95 } 95 }
96 96
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 { 192 {
193 if (!isValidPropertyName(name)) { 193 if (!isValidPropertyName(name)) {
194 es.throwDOMException(SyntaxError, ExceptionMessages::failedToDelete(name , "DOMStringMap", "'" + name + "' is not a valid property name.")); 194 es.throwDOMException(SyntaxError, ExceptionMessages::failedToDelete(name , "DOMStringMap", "'" + name + "' is not a valid property name."));
195 return; 195 return;
196 } 196 }
197 197
198 m_element->removeAttribute(convertPropertyNameToAttributeName(name)); 198 m_element->removeAttribute(convertPropertyNameToAttributeName(name));
199 } 199 }
200 200
201 } // namespace WebCore 201 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/DOMStringMap.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698