<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188735] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188735">188735</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-08-20 19:10:29 -0700 (Thu, 20 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>getElementsByClassName() should return an HTMLCollection
https://bugs.webkit.org/show_bug.cgi?id=147980

Reviewed by Darin Adler.

Source/WebCore:

Update Document.getElementsByClassName() and Element.getElementsByClassName()
to return an HTMLCollection instead of a NodeList, as per the specification:
- https://dom.spec.whatwg.org/#interface-document
- https://dom.spec.whatwg.org/#interface-element

This behavior is also consistent with other major browsers. Due to this and
the fact that NodeList / HTMLCollection pretty much the same API, the
compatibility risk should be fairly low.

I also verified that the performance is the same according to the following
performance test:
PerformanceTests/DOM/get-elements-by-class-name-traversal-uncached.html

Tests: fast/dom/getElementsByClassName/dumpHTMLCollection.html
       fast/dom/getElementsByClassName/return-type.html

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
Rename ClassNodeList.cpp file.

* bindings/scripts/CodeGeneratorObjC.pm:
(GetImplClassName):
Indicate that NodeList is implemented as NodeListBase. This is
needed so that DOMNodeList can have either an HTMLCollection or
a NodeList as internal representation. NodeListBase is a new
common base class for HTMLCollection and NodeList.

* dom/ClassCollection.cpp: Renamed from Source/WebCore/dom/ClassNodeList.cpp.
(WebCore::ClassCollection::create):
(WebCore::ClassCollection::~ClassCollection):
* dom/ClassCollection.h: Renamed from Source/WebCore/dom/ClassNodeList.h.
(WebCore::ClassCollection::ClassCollection):
(WebCore::ClassCollection::elementMatches):
Rename ClassNodeList to ClassCollection and have it subclass
CachedHTMLCollection instead of ClassNodeList.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getElementsByClassName):
Have getElementsByClassName return an HTMLCollection instead of a
NodeList.

(WebCore::ContainerNode::getElementsByClassNameForObjC):
New method returns a NodeListBase for ObjC bindings, so they can
convert the return value into a DOMNodeList. We need this to not
break ObjC API compatibility.

* dom/Document.idl:
* dom/Element.idl:
Have getElementsByClassName return an HTMLCollection instead of a
NodeList, except for ObjC bindings.

* dom/NodeList.h:
Have NodeList subclass NodeListBase.

* dom/NodeListBase.h: Added.
New common base interface for HTMLCollection and NodeList. This is
so that the internal representation for ObjC's DOMNodeList can be
a NodeListBase instead of a NodeList. This way, the ObjC API can
keep returning a DOMNodeList, even though our implementation now
returns an HTMLCollection instead of a NodeList.

* dom/NodeRareData.h:
(WebCore::NodeListTypeIdentifier&lt;NameNodeList&gt;::value):
(WebCore::NodeListTypeIdentifier&lt;TagNodeList&gt;::value):
(WebCore::NodeListTypeIdentifier&lt;HTMLTagNodeList&gt;::value):
(WebCore::NodeListTypeIdentifier&lt;RadioNodeList&gt;::value):
(WebCore::NodeListTypeIdentifier&lt;LabelsNodeList&gt;::value):
Drop ClassNodeList from the NodeListTypeIndentifiers.

* html/CollectionType.h:
Add new ByClass CollectionType for ClassCollection.

* html/GenericCachedHTMLCollection.cpp:
(WebCore::GenericCachedHTMLCollection&lt;traversalType&gt;::elementMatches):
Handle new ByClass CollectionType in the switch statement.

* html/HTMLCollection.cpp:
(WebCore::invalidationTypeExcludingIdAndNameAttributes):
(WebCore::HTMLCollection::~HTMLCollection):
Add support for new ByClass Collection type.

* html/HTMLCollection.h:
Have HTMLCollection subclass the NodeListBase interface.

LayoutTests:

* fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt.
* fast/dom/getElementsByClassName/dumpHTMLCollection.html: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html.
Rename test now that getElementsByClassName returns an HTMLCollection
and update the test to update the HTMLCollection prototype instead
of the NodeList one.

* fast/dom/getElementsByClassName/return-type-expected.txt: Added.
* fast/dom/getElementsByClassName/return-type.html: Added.
New test that checks that getElementsByClassName() returns an
HTMLCollection.

* inspector/model/remote-object-expected.txt:
Rebaseline.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectexpectedtxt">trunk/LayoutTests/inspector/model/remote-object-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorObjCpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeh">trunk/Source/WebCore/dom/ContainerNode.h</a></li>
<li><a href="#trunkSourceWebCoredomDOMAllInOnecpp">trunk/Source/WebCore/dom/DOMAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCoredomElementidl">trunk/Source/WebCore/dom/Element.idl</a></li>
<li><a href="#trunkSourceWebCoredomLiveNodeListcpp">trunk/Source/WebCore/dom/LiveNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeListh">trunk/Source/WebCore/dom/NodeList.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeRareDatah">trunk/Source/WebCore/dom/NodeRareData.h</a></li>
<li><a href="#trunkSourceWebCorehtmlCollectionTypeh">trunk/Source/WebCore/html/CollectionType.h</a></li>
<li><a href="#trunkSourceWebCorehtmlGenericCachedHTMLCollectioncpp">trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCollectioncpp">trunk/Source/WebCore/html/HTMLCollection.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCollectionh">trunk/Source/WebCore/html/HTMLCollection.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionexpectedtxt">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionhtml">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamereturntypeexpectedtxt">trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamereturntypehtml">trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html</a></li>
<li><a href="#trunkSourceWebCoredomClassCollectioncpp">trunk/Source/WebCore/dom/ClassCollection.cpp</a></li>
<li><a href="#trunkSourceWebCoredomClassCollectionh">trunk/Source/WebCore/dom/ClassCollection.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeListBaseh">trunk/Source/WebCore/dom/NodeListBase.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListexpectedtxt">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListhtml">trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html</a></li>
<li><a href="#trunkSourceWebCoredomClassNodeListcpp">trunk/Source/WebCore/dom/ClassNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCoredomClassNodeListh">trunk/Source/WebCore/dom/ClassNodeList.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/ChangeLog        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-08-20  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        getElementsByClassName() should return an HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=147980
+
+        Reviewed by Darin Adler.
+
+        * fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt.
+        * fast/dom/getElementsByClassName/dumpHTMLCollection.html: Renamed from LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html.
+        Rename test now that getElementsByClassName returns an HTMLCollection
+        and update the test to update the HTMLCollection prototype instead
+        of the NodeList one.
+
+        * fast/dom/getElementsByClassName/return-type-expected.txt: Added.
+        * fast/dom/getElementsByClassName/return-type.html: Added.
+        New test that checks that getElementsByClassName() returns an
+        HTMLCollection.
+
+        * inspector/model/remote-object-expected.txt:
+        Rebaseline.
+
</ins><span class="cx"> 2015-08-20  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Test gardening after r188167
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionexpectedtxtfromrev188734trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt (from rev 188734, trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+Line 1
+Line 2
+Line 3
+
+line 4
+line 5
+
+[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3
+[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4
+[object HTMLDivElement], [object HTMLDivElement], length: 2
+[object HTMLDivElement], [object HTMLDivElement], length: 2
+length: 0
+length: 0
+length: 0
+length: 0
+length: 0
+[object HTMLDivElement], length: 1
+[object HTMLDivElement], [object HTMLParagraphElement], length: 2
+[object HTMLDivElement], length: 1
+[object HTMLDivElement], length: 1
+length: 0
+length: 0
+length: 0
+length: 0
+length: 0
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpHTMLCollectionhtmlfromrev188734trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html (from rev 188734, trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;div class=&quot;one&quot;&gt;Line 1&lt;div class=&quot;two&quot;&gt;Line 2&lt;/div&gt;&lt;p&gt;Line &lt;i&gt;3&lt;/i&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div id=&quot;test&quot; class=&quot;one two&quot;&gt;&lt;div class=&quot;one two&quot;&gt;line 4&lt;/div&gt;&lt;p class=&quot;two&quot;&gt;line 5&lt;/p&gt;&lt;/div&gt;
+&lt;p&gt;&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;&lt;/p&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function log(message)
+    {
+        var item = document.createElement(&quot;li&quot;);
+        item.appendChild(document.createTextNode(message));
+        document.getElementById(&quot;console&quot;).appendChild(item);
+    }
+    
+    HTMLCollection.prototype.dump = function()
+    {
+        var result = &quot;&quot;;
+        var i = 0;
+        for (; i &lt; this.length; i++)
+            result += this[i] + &quot;, &quot;;
+        result += &quot;length: &quot; + i;
+        return result;
+    }
+
+    try {
+        var elm = document.getElementById(&quot;test&quot;);
+
+        log(document.getElementsByClassName(&quot;one&quot;).dump());
+        log(document.getElementsByClassName(&quot;two&quot;).dump());
+        log(document.getElementsByClassName(&quot;one two&quot;).dump());
+        log(document.getElementsByClassName(&quot;one\t\t\n \ftwo&quot;).dump());
+        log(document.getElementsByClassName(&quot;&quot;).dump());
+        log(document.getElementsByClassName(&quot;onetwo&quot;).dump());
+        log(document.getElementsByClassName().dump());
+        log(document.getElementsByClassName(null).dump());
+        log(document.getElementsByClassName(undefined).dump());
+
+        log(elm.getElementsByClassName(&quot;one&quot;).dump());
+        log(elm.getElementsByClassName(&quot;two&quot;).dump());
+        log(elm.getElementsByClassName(&quot;one two&quot;).dump());
+        log(elm.getElementsByClassName(&quot;one\t\t\n \ftwo&quot;).dump());
+        log(elm.getElementsByClassName(&quot;&quot;).dump());
+        log(elm.getElementsByClassName(&quot;onetwo&quot;).dump());
+        log(elm.getElementsByClassName().dump());
+        log(elm.getElementsByClassName(null).dump());
+        log(elm.getElementsByClassName(undefined).dump());
+    } catch (ex) {
+        log(&quot;Exception: &quot; + ex.description);
+    }
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-Line 1
-Line 2
-Line 3
-
-line 4
-line 5
-
-[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3
-[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4
-[object HTMLDivElement], [object HTMLDivElement], length: 2
-[object HTMLDivElement], [object HTMLDivElement], length: 2
-length: 0
-length: 0
-length: 0
-length: 0
-length: 0
-[object HTMLDivElement], length: 1
-[object HTMLDivElement], [object HTMLParagraphElement], length: 2
-[object HTMLDivElement], length: 1
-[object HTMLDivElement], length: 1
-length: 0
-length: 0
-length: 0
-length: 0
-length: 0
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamedumpNodeListhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-&lt;html&gt;
-&lt;body&gt;
-&lt;div class=&quot;one&quot;&gt;Line 1&lt;div class=&quot;two&quot;&gt;Line 2&lt;/div&gt;&lt;p&gt;Line &lt;i&gt;3&lt;/i&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div id=&quot;test&quot; class=&quot;one two&quot;&gt;&lt;div class=&quot;one two&quot;&gt;line 4&lt;/div&gt;&lt;p class=&quot;two&quot;&gt;line 5&lt;/p&gt;&lt;/div&gt;
-&lt;p&gt;&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;&lt;/p&gt;
-&lt;script type=&quot;text/javascript&quot;&gt;
-    if (window.testRunner)
-        testRunner.dumpAsText();
-
-    function log(message)
-    {
-        var item = document.createElement(&quot;li&quot;);
-        item.appendChild(document.createTextNode(message));
-        document.getElementById(&quot;console&quot;).appendChild(item);
-    }
-    
-    NodeList.prototype.dump = function()
-    {
-        var result = &quot;&quot;;
-        var i = 0;
-        for (; i &lt; this.length; i++)
-            result += this[i] + &quot;, &quot;;
-        result += &quot;length: &quot; + i;
-        return result;
-    }
-
-    try {
-        var elm = document.getElementById(&quot;test&quot;);
-
-        log(document.getElementsByClassName(&quot;one&quot;).dump());
-        log(document.getElementsByClassName(&quot;two&quot;).dump());
-        log(document.getElementsByClassName(&quot;one two&quot;).dump());
-        log(document.getElementsByClassName(&quot;one\t\t\n \ftwo&quot;).dump());
-        log(document.getElementsByClassName(&quot;&quot;).dump());
-        log(document.getElementsByClassName(&quot;onetwo&quot;).dump());
-        log(document.getElementsByClassName().dump());
-        log(document.getElementsByClassName(null).dump());
-        log(document.getElementsByClassName(undefined).dump());
-
-        log(elm.getElementsByClassName(&quot;one&quot;).dump());
-        log(elm.getElementsByClassName(&quot;two&quot;).dump());
-        log(elm.getElementsByClassName(&quot;one two&quot;).dump());
-        log(elm.getElementsByClassName(&quot;one\t\t\n \ftwo&quot;).dump());
-        log(elm.getElementsByClassName(&quot;&quot;).dump());
-        log(elm.getElementsByClassName(&quot;onetwo&quot;).dump());
-        log(elm.getElementsByClassName().dump());
-        log(elm.getElementsByClassName(null).dump());
-        log(elm.getElementsByClassName(undefined).dump());
-    } catch (ex) {
-        log(&quot;Exception: &quot; + ex.description);
-    }
-&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamereturntypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/return-type-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Tests that getElementsByTagName() returns an HTMLCollection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS document.getElementsByClassName(&quot;test&quot;).__proto__ is HTMLCollection.prototype
+PASS document.body.getElementsByClassName(&quot;test&quot;).__proto__ is HTMLCollection.prototype
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomgetElementsByClassNamereturntypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/return-type.html        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that getElementsByTagName() returns an HTMLCollection.&quot;);
+
+shouldBe('document.getElementsByClassName(&quot;test&quot;).__proto__', 'HTMLCollection.prototype');
+shouldBe('document.body.getElementsByClassName(&quot;test&quot;).__proto__', 'HTMLCollection.prototype');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-post.js&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -2004,12 +2004,12 @@
</span><span class="cx">   &quot;_type&quot;: &quot;object&quot;,
</span><span class="cx">   &quot;_subtype&quot;: &quot;array&quot;,
</span><span class="cx">   &quot;_objectId&quot;: &quot;&lt;filtered&gt;&quot;,
</span><del>-  &quot;_description&quot;: &quot;NodeList&quot;,
</del><ins>+  &quot;_description&quot;: &quot;HTMLCollection&quot;,
</ins><span class="cx">   &quot;_size&quot;: 3,
</span><span class="cx">   &quot;_preview&quot;: {
</span><span class="cx">     &quot;_type&quot;: &quot;object&quot;,
</span><span class="cx">     &quot;_subtype&quot;: &quot;array&quot;,
</span><del>-    &quot;_description&quot;: &quot;NodeList&quot;,
</del><ins>+    &quot;_description&quot;: &quot;HTMLCollection&quot;,
</ins><span class="cx">     &quot;_lossless&quot;: false,
</span><span class="cx">     &quot;_overflow&quot;: false,
</span><span class="cx">     &quot;_size&quot;: 3,
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1357,7 +1357,7 @@
</span><span class="cx">     dom/CheckedRadioButtons.cpp
</span><span class="cx">     dom/ChildListMutationScope.cpp
</span><span class="cx">     dom/ChildNodeList.cpp
</span><del>-    dom/ClassNodeList.cpp
</del><ins>+    dom/ClassCollection.cpp
</ins><span class="cx">     dom/ClientRect.cpp
</span><span class="cx">     dom/ClientRectList.cpp
</span><span class="cx">     dom/ClipboardEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/ChangeLog        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,3 +1,95 @@
</span><ins>+2015-08-20  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        getElementsByClassName() should return an HTMLCollection
+        https://bugs.webkit.org/show_bug.cgi?id=147980
+
+        Reviewed by Darin Adler.
+
+        Update Document.getElementsByClassName() and Element.getElementsByClassName()
+        to return an HTMLCollection instead of a NodeList, as per the specification:
+        - https://dom.spec.whatwg.org/#interface-document
+        - https://dom.spec.whatwg.org/#interface-element
+
+        This behavior is also consistent with other major browsers. Due to this and
+        the fact that NodeList / HTMLCollection pretty much the same API, the
+        compatibility risk should be fairly low.
+
+        I also verified that the performance is the same according to the following
+        performance test:
+        PerformanceTests/DOM/get-elements-by-class-name-traversal-uncached.html
+
+        Tests: fast/dom/getElementsByClassName/dumpHTMLCollection.html
+               fast/dom/getElementsByClassName/return-type.html
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        Rename ClassNodeList.cpp file.
+
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        (GetImplClassName):
+        Indicate that NodeList is implemented as NodeListBase. This is
+        needed so that DOMNodeList can have either an HTMLCollection or
+        a NodeList as internal representation. NodeListBase is a new
+        common base class for HTMLCollection and NodeList.
+
+        * dom/ClassCollection.cpp: Renamed from Source/WebCore/dom/ClassNodeList.cpp.
+        (WebCore::ClassCollection::create):
+        (WebCore::ClassCollection::~ClassCollection):
+        * dom/ClassCollection.h: Renamed from Source/WebCore/dom/ClassNodeList.h.
+        (WebCore::ClassCollection::ClassCollection):
+        (WebCore::ClassCollection::elementMatches):
+        Rename ClassNodeList to ClassCollection and have it subclass
+        CachedHTMLCollection instead of ClassNodeList.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::getElementsByClassName):
+        Have getElementsByClassName return an HTMLCollection instead of a
+        NodeList.
+
+        (WebCore::ContainerNode::getElementsByClassNameForObjC):
+        New method returns a NodeListBase for ObjC bindings, so they can
+        convert the return value into a DOMNodeList. We need this to not
+        break ObjC API compatibility.
+
+        * dom/Document.idl:
+        * dom/Element.idl:
+        Have getElementsByClassName return an HTMLCollection instead of a
+        NodeList, except for ObjC bindings.
+
+        * dom/NodeList.h:
+        Have NodeList subclass NodeListBase.
+
+        * dom/NodeListBase.h: Added.
+        New common base interface for HTMLCollection and NodeList. This is
+        so that the internal representation for ObjC's DOMNodeList can be
+        a NodeListBase instead of a NodeList. This way, the ObjC API can
+        keep returning a DOMNodeList, even though our implementation now
+        returns an HTMLCollection instead of a NodeList.
+
+        * dom/NodeRareData.h:
+        (WebCore::NodeListTypeIdentifier&lt;NameNodeList&gt;::value):
+        (WebCore::NodeListTypeIdentifier&lt;TagNodeList&gt;::value):
+        (WebCore::NodeListTypeIdentifier&lt;HTMLTagNodeList&gt;::value):
+        (WebCore::NodeListTypeIdentifier&lt;RadioNodeList&gt;::value):
+        (WebCore::NodeListTypeIdentifier&lt;LabelsNodeList&gt;::value):
+        Drop ClassNodeList from the NodeListTypeIndentifiers.
+
+        * html/CollectionType.h:
+        Add new ByClass CollectionType for ClassCollection.
+
+        * html/GenericCachedHTMLCollection.cpp:
+        (WebCore::GenericCachedHTMLCollection&lt;traversalType&gt;::elementMatches):
+        Handle new ByClass CollectionType in the switch statement.
+
+        * html/HTMLCollection.cpp:
+        (WebCore::invalidationTypeExcludingIdAndNameAttributes):
+        (WebCore::HTMLCollection::~HTMLCollection):
+        Add support for new ByClass Collection type.
+
+        * html/HTMLCollection.h:
+        Have HTMLCollection subclass the NodeListBase interface.
+
</ins><span class="cx"> 2015-08-20  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the iOS build after r188726
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -13603,7 +13603,7 @@
</span><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Production|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Production|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><del>-    &lt;ClCompile Include=&quot;..\dom\ClassNodeList.cpp&quot;&gt;
</del><ins>+    &lt;ClCompile Include=&quot;..\dom\ClassCollection.cpp&quot;&gt;
</ins><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="lines">@@ -22020,7 +22020,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\dom\CheckedRadioButtons.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\dom\ChildListMutationScope.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\dom\ChildNodeList.h&quot; /&gt;
</span><del>-    &lt;ClInclude Include=&quot;..\dom\ClassNodeList.h&quot; /&gt;
</del><ins>+    &lt;ClInclude Include=&quot;..\dom\ClassCollection.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\dom\ClientRect.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\dom\ClientRectList.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\dom\ClipboardEvent.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -2677,10 +2677,10 @@
</span><span class="cx">                 830030F51B7D33B500ED3AAC /* GenericCachedHTMLCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */; };
</span><span class="cx">                 830030F61B7D33B500ED3AAC /* GenericCachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */; };
</span><span class="cx">                 830030F81B7D3B7800ED3AAC /* CachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */; };
</span><del>-                831D48C01B7D9A52006DE39A /* ClassNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */; };
-                831D48C11B7D9A52006DE39A /* ClassNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 831D48BF1B7D9A46006DE39A /* ClassNodeList.h */; };
</del><span class="cx">                 832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
</span><span class="cx">                 832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
</span><ins>+                8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8348BFA91B85729500912F36 /* ClassCollection.cpp */; };
+                8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; };
</ins><span class="cx">                 83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
</span><span class="cx">                 835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
</span><span class="cx">                 836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
</span><span class="lines">@@ -2690,6 +2690,7 @@
</span><span class="cx">                 8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
</span><span class="cx">                 839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
</span><span class="cx">                 839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
</span><ins>+                83AAE64A1B85816B009FAF70 /* NodeListBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AAE6491B858168009FAF70 /* NodeListBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
</span><span class="cx">                 83C05A5A1A686212007E5DEA /* StylePropertyShorthandFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */; };
</span><span class="cx">                 83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */; };
</span><span class="lines">@@ -10040,10 +10041,10 @@
</span><span class="cx">                 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericCachedHTMLCollection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCachedHTMLCollection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedHTMLCollection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassNodeList.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                831D48BF1B7D9A46006DE39A /* ClassNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassNodeList.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                8348BFA91B85729500912F36 /* ClassCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassCollection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                8348BFAA1B85729500912F36 /* ClassCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassCollection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -10054,6 +10055,7 @@
</span><span class="cx">                 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                83AAE6491B858168009FAF70 /* NodeListBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeListBase.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23177,8 +23179,8 @@
</span><span class="cx">                                 83D26D3C1AFDCC50001B3873 /* ChildNode.idl */,
</span><span class="cx">                                 A818721A0977D3C0005826D9 /* ChildNodeList.cpp */,
</span><span class="cx">                                 A81872150977D3C0005826D9 /* ChildNodeList.h */,
</span><del>-                                831D48BE1B7D9A46006DE39A /* ClassNodeList.cpp */,
-                                831D48BF1B7D9A46006DE39A /* ClassNodeList.h */,
</del><ins>+                                8348BFA91B85729500912F36 /* ClassCollection.cpp */,
+                                8348BFAA1B85729500912F36 /* ClassCollection.h */,
</ins><span class="cx">                                 BCC065770F3CE1B700CD2D87 /* ClientRect.cpp */,
</span><span class="cx">                                 BCC065780F3CE1B700CD2D87 /* ClientRect.h */,
</span><span class="cx">                                 BCC065790F3CE1B700CD2D87 /* ClientRect.idl */,
</span><span class="lines">@@ -23402,6 +23404,7 @@
</span><span class="cx">                                 1A750D870A90E394000FF215 /* NodeIterator.idl */,
</span><span class="cx">                                 A81872100977D3C0005826D9 /* NodeList.h */,
</span><span class="cx">                                 85ACA9FA0A9B631000671E90 /* NodeList.idl */,
</span><ins>+                                83AAE6491B858168009FAF70 /* NodeListBase.h */,
</ins><span class="cx">                                 7CEAC1081B483D7F00334482 /* NodeOrString.cpp */,
</span><span class="cx">                                 7CEAC1061B483D1D00334482 /* NodeOrString.h */,
</span><span class="cx">                                 4FAB48661643A67E00F70C07 /* NodeRareData.cpp */,
</span><span class="lines">@@ -24571,7 +24574,6 @@
</span><span class="cx">                                 85E711960AC5D5350053270F /* DOMDocumentTypeInternal.h in Headers */,
</span><span class="cx">                                 8518DCE90A9CC80D0091B7A6 /* DOMDOMImplementation.h in Headers */,
</span><span class="cx">                                 85E711970AC5D5350053270F /* DOMDOMImplementationInternal.h in Headers */,
</span><del>-                                831D48C11B7D9A52006DE39A /* ClassNodeList.h in Headers */,
</del><span class="cx">                                 52CCA9E815E3F64C0053C77F /* DOMDOMNamedFlowCollection.h in Headers */,
</span><span class="cx">                                 52CCA9EA15E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h in Headers */,
</span><span class="cx">                                 2D9A247415B9C2E300D34527 /* DOMDOMSecurityPolicy.h in Headers */,
</span><span class="lines">@@ -24796,6 +24798,7 @@
</span><span class="cx">                                 85E711D90AC5D5350053270F /* DOMTextInternal.h in Headers */,
</span><span class="cx">                                 188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
</span><span class="cx">                                 05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
</span><ins>+                                8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */,
</ins><span class="cx">                                 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
</span><span class="cx">                                 0F54DCD51880F867003EEDBB /* DOMTouch.h in Headers */,
</span><span class="cx">                                 0F54DCD71880F867003EEDBB /* DOMTouchEvent.h in Headers */,
</span><span class="lines">@@ -26233,6 +26236,7 @@
</span><span class="cx">                                 1477E7770BF4134A00152872 /* PageCache.h in Headers */,
</span><span class="cx">                                 CD5E5B5F1A15CE54000C609E /* PageConfiguration.h in Headers */,
</span><span class="cx">                                 F3820893147D35F90010BC06 /* PageConsoleAgent.h in Headers */,
</span><ins>+                                83AAE64A1B85816B009FAF70 /* NodeListBase.h in Headers */,
</ins><span class="cx">                                 DAED203116F244480070EC0F /* PageConsoleClient.h in Headers */,
</span><span class="cx">                                 A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */,
</span><span class="cx">                                 F34742DD134362F000531BC2 /* PageDebuggerAgent.h in Headers */,
</span><span class="lines">@@ -28997,7 +29001,6 @@
</span><span class="cx">                                 A9C6E64C0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp in Sources */,
</span><span class="cx">                                 A9C6E64D0D7465E7006442E9 /* JSDOMPluginCustom.cpp in Sources */,
</span><span class="cx">                                 E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */,
</span><del>-                                831D48C01B7D9A52006DE39A /* ClassNodeList.cpp in Sources */,
</del><span class="cx">                                 BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
</span><span class="cx">                                 4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */,
</span><span class="cx">                                 C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
</span><span class="lines">@@ -29884,6 +29887,7 @@
</span><span class="cx">                                 B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */,
</span><span class="cx">                                 A8EA7EBD0A1945D000A8EF5F /* ProcessingInstruction.cpp in Sources */,
</span><span class="cx">                                 E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */,
</span><ins>+                                8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */,
</ins><span class="cx">                                 A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */,
</span><span class="cx">                                 1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
</span><span class="cx">                                 E4BBED0E14F4025D003F0B98 /* PropertySetCSSStyleDeclaration.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorObjCpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -420,6 +420,7 @@
</span><span class="cx"> {
</span><span class="cx">     my $name = shift;
</span><span class="cx"> 
</span><ins>+    return &quot;NodeListBase&quot; if $name eq &quot;NodeList&quot;;
</ins><span class="cx">     return &quot;DOMWindow&quot; if $name eq &quot;AbstractView&quot;;
</span><span class="cx">     return $name;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomClassCollectioncppfromrev188734trunkSourceWebCoredomClassNodeListcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/ClassCollection.cpp (from rev 188734, trunk/Source/WebCore/dom/ClassNodeList.cpp) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassCollection.cpp                                (rev 0)
+++ trunk/Source/WebCore/dom/ClassCollection.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2007-2008, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. (&quot;Apple&quot;) nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ClassCollection.h&quot;
+
+#include &quot;NodeRareData.h&quot;
+#include &quot;StyledElement.h&quot;
+
+namespace WebCore {
+
+Ref&lt;ClassCollection&gt; ClassCollection::create(ContainerNode&amp; rootNode, CollectionType type, const AtomicString&amp; classNames)
+{
+    ASSERT(type == ByClass);
+    return adoptRef(*new ClassCollection(rootNode, type, classNames));
+}
+
+ClassCollection::~ClassCollection()
+{
+    ownerNode().nodeLists()-&gt;removeCachedCollection(this, m_originalClassNames);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoredomClassCollectionhfromrev188734trunkSourceWebCoredomClassNodeListh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/ClassCollection.h (from rev 188734, trunk/Source/WebCore/dom/ClassNodeList.h) (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassCollection.h                                (rev 0)
+++ trunk/Source/WebCore/dom/ClassCollection.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2007, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. (&quot;Apple&quot;) nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ClassCollection_h
+#define ClassCollection_h
+
+#include &quot;CachedHTMLCollection.h&quot;
+#include &quot;Element.h&quot;
+#include &quot;SpaceSplitString.h&quot;
+
+namespace WebCore {
+
+class ClassCollection final : public CachedHTMLCollection&lt;ClassCollection, CollectionTypeTraits&lt;ByClass&gt;::traversalType&gt; {
+public:
+    static Ref&lt;ClassCollection&gt; create(ContainerNode&amp;, CollectionType, const AtomicString&amp; classNames);
+
+    virtual ~ClassCollection();
+
+    bool elementMatches(Element&amp;) const;
+
+private:
+    ClassCollection(ContainerNode&amp; rootNode, CollectionType, const AtomicString&amp; classNames);
+
+    SpaceSplitString m_classNames;
+    AtomicString m_originalClassNames;
+};
+
+inline ClassCollection::ClassCollection(ContainerNode&amp; rootNode, CollectionType type, const AtomicString&amp; classNames)
+    : CachedHTMLCollection&lt;ClassCollection, CollectionTypeTraits&lt;ByClass&gt;::traversalType&gt;(rootNode, type)
+    , m_classNames(classNames, rootNode.document().inQuirksMode())
+    , m_originalClassNames(classNames)
+{
+}
+
+inline bool ClassCollection::elementMatches(Element&amp; element) const
+{
+    if (!element.hasClass())
+        return false;
+    if (!m_classNames.size())
+        return false;
+    // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
+    // https://bugs.webkit.org/show_bug.cgi?id=94718
+    if (!element.isStyledElement())
+        return false;
+    return element.classNames().containsAll(m_classNames);
+}
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_HTMLCOLLECTION(ClassCollection, ByClass)
+
+#endif // ClassCollection_h
</ins></span></pre></div>
<a id="trunkSourceWebCoredomClassNodeListcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/ClassNodeList.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassNodeList.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ClassNodeList.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-/*
- * Copyright (C) 2007-2008, 2014 Apple Inc. All rights reserved.
- * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Inc. (&quot;Apple&quot;) nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;ClassNodeList.h&quot;
-
-#include &quot;NodeRareData.h&quot;
-#include &quot;StyledElement.h&quot;
-
-namespace WebCore {
-
-Ref&lt;ClassNodeList&gt; ClassNodeList::create(ContainerNode&amp; rootNode, const AtomicString&amp; classNames)
-{
-    return adoptRef(*new ClassNodeList(rootNode, classNames));
-}
-
-ClassNodeList::~ClassNodeList()
-{
-    ownerNode().nodeLists()-&gt;removeCacheWithAtomicName(this, m_originalClassNames);
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoredomClassNodeListh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/ClassNodeList.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassNodeList.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ClassNodeList.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-/*
- * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
- * Copyright (C) 2007 David Smith (catfish.man@gmail.com)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Inc. (&quot;Apple&quot;) nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ClassNodeList_h
-#define ClassNodeList_h
-
-#include &quot;Element.h&quot;
-#include &quot;LiveNodeList.h&quot;
-#include &quot;Node.h&quot;
-#include &quot;SpaceSplitString.h&quot;
-
-namespace WebCore {
-
-class ClassNodeList final : public CachedLiveNodeList&lt;ClassNodeList&gt; {
-public:
-    static Ref&lt;ClassNodeList&gt; create(ContainerNode&amp;, const AtomicString&amp; classNames);
-
-    virtual ~ClassNodeList();
-
-    virtual bool elementMatches(Element&amp;) const override;
-    virtual bool isRootedAtDocument() const override { return false; }
-
-private:
-    ClassNodeList(ContainerNode&amp; rootNode, const AtomicString&amp; classNames);
-
-    SpaceSplitString m_classNames;
-    AtomicString m_originalClassNames;
-};
-
-inline ClassNodeList::ClassNodeList(ContainerNode&amp; rootNode, const AtomicString&amp; classNames)
-    : CachedLiveNodeList(rootNode, InvalidateOnClassAttrChange)
-    , m_classNames(classNames, document().inQuirksMode())
-    , m_originalClassNames(classNames)
-{
-}
-
-inline bool ClassNodeList::elementMatches(Element&amp; element) const
-{
-    if (!element.hasClass())
-        return false;
-    if (!m_classNames.size())
-        return false;
-    // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
-    // https://bugs.webkit.org/show_bug.cgi?id=94718
-    if (!element.isStyledElement())
-        return false;
-    return element.classNames().containsAll(m_classNames);
-}
-
-} // namespace WebCore
-
-#endif // ClassNodeList_h
</del></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include &quot;ChildListMutationScope.h&quot;
</span><span class="cx"> #include &quot;Chrome.h&quot;
</span><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><del>-#include &quot;ClassNodeList.h&quot;
</del><ins>+#include &quot;ClassCollection.h&quot;
</ins><span class="cx"> #include &quot;ContainerNodeAlgorithms.h&quot;
</span><span class="cx"> #include &quot;Editor.h&quot;
</span><span class="cx"> #include &quot;FloatRect.h&quot;
</span><span class="lines">@@ -890,11 +890,16 @@
</span><span class="cx">     return ensureRareData().ensureNodeLists().addCacheWithAtomicName&lt;NameNodeList&gt;(*this, elementName);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;NodeList&gt; ContainerNode::getElementsByClassName(const AtomicString&amp; classNames)
</del><ins>+RefPtr&lt;HTMLCollection&gt; ContainerNode::getElementsByClassName(const AtomicString&amp; classNames)
</ins><span class="cx"> {
</span><del>-    return ensureRareData().ensureNodeLists().addCacheWithAtomicName&lt;ClassNodeList&gt;(*this, classNames);
</del><ins>+    return ensureRareData().ensureNodeLists().addCachedCollection&lt;ClassCollection&gt;(*this, ByClass, classNames);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RefPtr&lt;NodeListBase&gt; ContainerNode::getElementsByClassNameForObjC(const AtomicString&amp; classNames)
+{
+    return getElementsByClassName(classNames);
+}
+
</ins><span class="cx"> RefPtr&lt;RadioNodeList&gt; ContainerNode::radioNodeList(const AtomicString&amp; name)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(hasTagName(HTMLNames::formTag) || hasTagName(HTMLNames::fieldsetTag));
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/ContainerNode.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class HTMLCollection;
</span><ins>+class NodeListBase;
</ins><span class="cx"> class NodeOrString;
</span><span class="cx"> class QualifiedName;
</span><span class="cx"> class RenderElement;
</span><span class="lines">@@ -145,7 +146,8 @@
</span><span class="cx">     RefPtr&lt;NodeList&gt; getElementsByTagName(const AtomicString&amp;);
</span><span class="cx">     RefPtr&lt;NodeList&gt; getElementsByTagNameNS(const AtomicString&amp; namespaceURI, const AtomicString&amp; localName);
</span><span class="cx">     RefPtr&lt;NodeList&gt; getElementsByName(const String&amp; elementName);
</span><del>-    RefPtr&lt;NodeList&gt; getElementsByClassName(const AtomicString&amp; classNames);
</del><ins>+    RefPtr&lt;HTMLCollection&gt; getElementsByClassName(const AtomicString&amp; classNames);
+    RefPtr&lt;NodeListBase&gt; getElementsByClassNameForObjC(const AtomicString&amp; classNames);
</ins><span class="cx">     RefPtr&lt;RadioNodeList&gt; radioNodeList(const AtomicString&amp;);
</span><span class="cx"> 
</span><span class="cx">     // From the ParentNode interface - https://dom.spec.whatwg.org/#interface-parentnode
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMAllInOne.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #include &quot;CheckedRadioButtons.cpp&quot;
</span><span class="cx"> #include &quot;ChildListMutationScope.cpp&quot;
</span><span class="cx"> #include &quot;ChildNodeList.cpp&quot;
</span><del>-#include &quot;ClassNodeList.cpp&quot;
</del><ins>+#include &quot;ClassCollection.cpp&quot;
</ins><span class="cx"> #include &quot;ClientRect.cpp&quot;
</span><span class="cx"> #include &quot;ClientRectList.cpp&quot;
</span><span class="cx"> #include &quot;ClipboardEvent.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/Document.idl        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -210,7 +210,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // HTML 5
</span><del>-    NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);
</del><ins>+#if defined(LANGUAGE_OBJECTIVE_C) &amp;&amp; LANGUAGE_OBJECTIVE_C
+    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames);
+#else
+    HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString classNames);
+#endif
</ins><span class="cx"> 
</span><span class="cx">     readonly attribute Element activeElement;
</span><span class="cx">     boolean hasFocus();
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.idl (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.idl        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/Element.idl        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -107,7 +107,11 @@
</span><span class="cx">     void scrollByPages([Default=Undefined] optional long pages);
</span><span class="cx"> 
</span><span class="cx">     // HTML 5
</span><del>-    NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
</del><ins>+#if defined(LANGUAGE_OBJECTIVE_C) &amp;&amp; LANGUAGE_OBJECTIVE_C
+    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
+#else
+    HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString name);
+#endif
</ins><span class="cx">     [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
</span><span class="cx">     [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
</span><span class="cx">              
</span></span></pre></div>
<a id="trunkSourceWebCoredomLiveNodeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LiveNodeList.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LiveNodeList.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/LiveNodeList.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;LiveNodeList.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;ClassNodeList.h&quot;
</del><ins>+#include &quot;ClassCollection.h&quot;
</ins><span class="cx"> #include &quot;Element.h&quot;
</span><span class="cx"> #include &quot;ElementTraversal.h&quot;
</span><span class="cx"> #include &quot;HTMLCollection.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/Node.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Attribute;
</span><del>-class ClassNodeList;
</del><ins>+class ClassCollection;
</ins><span class="cx"> class ContainerNode;
</span><span class="cx"> class DOMSettableTokenList;
</span><span class="cx"> class Document;
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NodeList.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeList.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/NodeList.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -24,21 +24,19 @@
</span><span class="cx"> #ifndef NodeList_h
</span><span class="cx"> #define NodeList_h
</span><span class="cx"> 
</span><ins>+#include &quot;NodeListBase.h&quot;
</ins><span class="cx"> #include &quot;ScriptWrappable.h&quot;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Node;
</span><span class="cx"> 
</span><del>-class NodeList : public ScriptWrappable, public RefCounted&lt;NodeList&gt; {
</del><ins>+class NodeList : public NodeListBase, public ScriptWrappable {
</ins><span class="cx"> public:
</span><span class="cx">     virtual ~NodeList() { }
</span><span class="cx"> 
</span><span class="cx">     // DOM methods &amp; attributes for NodeList
</span><del>-    virtual unsigned length() const = 0;
-    virtual Node* item(unsigned index) const = 0;
</del><span class="cx">     virtual Node* namedItem(const AtomicString&amp;) const = 0;
</span><span class="cx"> 
</span><span class="cx">     // Other methods (not part of DOM)
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeListBaseh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/NodeListBase.h (0 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeListBase.h                                (rev 0)
+++ trunk/Source/WebCore/dom/NodeListBase.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NodeListBase_h
+#define NodeListBase_h
+
+#include &lt;wtf/RefCounted.h&gt;
+
+namespace WebCore {
+
+class Node;
+
+// This is a common base class for NodeList / HTMLCollection to maintain legacy ObjC API compatibility.
+class NodeListBase : public RefCounted&lt;NodeListBase&gt; {
+public:
+    virtual ~NodeListBase() { }
+
+    virtual unsigned length() const = 0;
+    virtual Node* item(unsigned index) const = 0;
+};
+
+} // namespace WebCore.
+
+#endif // NodeListBase_h
+
</ins></span></pre></div>
<a id="trunkSourceWebCoredomNodeRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NodeRareData.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeRareData.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/dom/NodeRareData.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> #define NodeRareData_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ChildNodeList.h&quot;
</span><del>-#include &quot;ClassNodeList.h&quot;
</del><ins>+#include &quot;ClassCollection.h&quot;
</ins><span class="cx"> #include &quot;DOMSettableTokenList.h&quot;
</span><span class="cx"> #include &quot;HTMLCollection.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="lines">@@ -47,12 +47,11 @@
</span><span class="cx"> class TreeScope;
</span><span class="cx"> 
</span><span class="cx"> template &lt;class ListType&gt; struct NodeListTypeIdentifier;
</span><del>-template &lt;&gt; struct NodeListTypeIdentifier&lt;ClassNodeList&gt; { static int value() { return 0; } };
-template &lt;&gt; struct NodeListTypeIdentifier&lt;NameNodeList&gt; { static int value() { return 1; } };
-template &lt;&gt; struct NodeListTypeIdentifier&lt;TagNodeList&gt; { static int value() { return 2; } };
-template &lt;&gt; struct NodeListTypeIdentifier&lt;HTMLTagNodeList&gt; { static int value() { return 3; } };
-template &lt;&gt; struct NodeListTypeIdentifier&lt;RadioNodeList&gt; { static int value() { return 4; } };
-template &lt;&gt; struct NodeListTypeIdentifier&lt;LabelsNodeList&gt; { static int value() { return 5; } };
</del><ins>+template &lt;&gt; struct NodeListTypeIdentifier&lt;NameNodeList&gt; { static int value() { return 0; } };
+template &lt;&gt; struct NodeListTypeIdentifier&lt;TagNodeList&gt; { static int value() { return 1; } };
+template &lt;&gt; struct NodeListTypeIdentifier&lt;HTMLTagNodeList&gt; { static int value() { return 2; } };
+template &lt;&gt; struct NodeListTypeIdentifier&lt;RadioNodeList&gt; { static int value() { return 3; } };
+template &lt;&gt; struct NodeListTypeIdentifier&lt;LabelsNodeList&gt; { static int value() { return 4; } };
</ins><span class="cx"> 
</span><span class="cx"> class NodeListsNodeData {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlCollectionTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/CollectionType.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/CollectionType.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/CollectionType.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -50,7 +50,8 @@
</span><span class="cx">     SelectedOptions,
</span><span class="cx">     DataListOptions,
</span><span class="cx">     MapAreas,
</span><del>-    FormControls
</del><ins>+    FormControls,
+    ByClass,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum class CollectionTraversalType { Descendants, ChildrenOnly, CustomForwardOnly };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlGenericCachedHTMLCollectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/GenericCachedHTMLCollection.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx">         return (element.hasTagName(aTag) || element.hasTagName(areaTag)) &amp;&amp; element.fastHasAttribute(hrefAttr);
</span><span class="cx">     case DocAnchors:
</span><span class="cx">         return element.hasTagName(aTag) &amp;&amp; element.fastHasAttribute(nameAttr);
</span><ins>+    case ByClass:
</ins><span class="cx">     case DocAll:
</span><span class="cx">     case DocumentNamedItems:
</span><span class="cx">     case FormControls:
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCollectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCollection.cpp (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCollection.cpp        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/HTMLCollection.cpp        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">     case DocumentNamedItems:
</span><span class="cx">     case FormControls:
</span><span class="cx">         return HTMLCollection::IsRootedAtDocument;
</span><ins>+    case ByClass:
</ins><span class="cx">     case NodeChildren:
</span><span class="cx">     case TableTBodies:
</span><span class="cx">     case TSectionRows:
</span><span class="lines">@@ -82,6 +83,8 @@
</span><span class="cx">     case DataListOptions:
</span><span class="cx">         // FIXME: We can do better some day.
</span><span class="cx">         return InvalidateOnAnyAttrChange;
</span><ins>+    case ByClass:
+        return InvalidateOnClassAttrChange;
</ins><span class="cx">     case DocAnchors:
</span><span class="cx">         return InvalidateOnNameAttrChange;
</span><span class="cx">     case DocLinks:
</span><span class="lines">@@ -113,9 +116,16 @@
</span><span class="cx">     if (hasNamedElementCache())
</span><span class="cx">         document().collectionWillClearIdNameMap(*this);
</span><span class="cx"> 
</span><del>-    // HTMLNameCollection removes cache by itself.
-    if (type() != WindowNamedItems &amp;&amp; type() != DocumentNamedItems)
</del><ins>+    // HTMLNameCollection &amp; ClassCollection remove cache by themselves.
+    // FIXME: We need a cleaner way to handle this.
+    switch (type()) {
+    case ByClass:
+    case WindowNamedItems:
+    case DocumentNamedItems:
+        break;
+    default:
</ins><span class="cx">         ownerNode().nodeLists()-&gt;removeCachedCollection(this);
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLCollection::invalidateCache(Document&amp; document)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCollectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCollection.h (188734 => 188735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCollection.h        2015-08-21 01:46:36 UTC (rev 188734)
+++ trunk/Source/WebCore/html/HTMLCollection.h        2015-08-21 02:10:29 UTC (rev 188735)
</span><span class="lines">@@ -58,13 +58,12 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class HTMLCollection : public ScriptWrappable, public RefCounted&lt;HTMLCollection&gt; {
</del><ins>+class HTMLCollection : public NodeListBase, public ScriptWrappable {
</ins><span class="cx"> public:
</span><span class="cx">     virtual ~HTMLCollection();
</span><span class="cx"> 
</span><span class="cx">     // DOM API
</span><del>-    virtual unsigned length() const = 0;
-    virtual Element* item(unsigned offset) const = 0;
</del><ins>+    virtual Element* item(unsigned index) const = 0; // Tighten return type from NodeListBase::item().
</ins><span class="cx">     virtual Element* namedItem(const AtomicString&amp; name) const = 0;
</span><span class="cx">     PassRefPtr&lt;NodeList&gt; tags(const String&amp;);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>