Changeset 143076 in webkit
- Timestamp:
- Feb 15, 2013 5:39:19 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143075 r143076 1 2013-02-15 Andreas Kling <akling@apple.com> 2 3 Calling DOM Element.attributes shouldn't force creation of ElementData. 4 <http://webkit.org/b/109976> 5 6 Reviewed by Darin Adler. 7 8 Don't create ElementData for an Element unnecessarily just because someone calls .attributes on it. 9 Previously, JS like this would create empty ElementData when 'element' has no attributes: 10 11 for (i = 0; i < element.attributes.length; ++i) 12 doStuff(element.attributes[i]); 13 14 Make NamedNodeMap::length() short-circuit and return 0 if !Element::hasAttributes(). 15 16 * dom/Element.cpp: 17 (WebCore::Element::attributes): 18 * dom/NamedNodeMap.cpp: 19 (WebCore::NamedNodeMap::length): 20 1 21 2013-02-15 Kentaro Hara <haraken@chromium.org> 2 22 -
trunk/Source/WebCore/dom/Element.cpp
r143054 r143076 314 314 NamedNodeMap* Element::attributes() const 315 315 { 316 ensureElementDataWithSynchronizedAttributes();317 316 ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareData(); 318 317 if (NamedNodeMap* attributeMap = rareData->attributeMap()) -
trunk/Source/WebCore/dom/NamedNodeMap.cpp
r141300 r143076 111 111 size_t NamedNodeMap::length() const 112 112 { 113 if (!m_element->hasAttributes()) 114 return 0; 113 115 return m_element->attributeCount(); 114 116 }
Note: See TracChangeset
for help on using the changeset viewer.