Skip to content

Commit 5b90d81

Browse files
committed
Noted support of SVG documents for class methods
Fixes jquerygh-885 Closes jquerygh-886
1 parent 674b751 commit 5b90d81

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

entries/hasClass.xml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ $( "#mydiv" ).hasClass( "bar" )
2525
<pre><code>
2626
$( "#mydiv" ).hasClass( "quux" )
2727
</code></pre>
28+
<p>As of jQuery 1.12/2.2, this method supports XML documents, including SVG.</p>
2829
</longdesc>
2930
<example>
3031
<desc>Looks for the paragraph that contains 'selected' as a class.</desc>

entries/toggleClass.xml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
</signature>
3838
<desc>Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.</desc>
3939
<longdesc>
40+
<p>Before jQuery version 1.12/2.2, the <code>.toggleClass()</code> method manipulated the <code>className</code> <em>property</em> of the selected elements, not the <code>class</code> <em>attribute</em>. Once the property was changed, it was the browser that updated the attribute accordingly. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).</p>
41+
<p>As of jQuery 1.12/2.2, this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the <code>class</code> <em>attribute</em> is used instead. So, <code>.toggleClass()</code> can be used on XML or SVG documents.</p>
4042
<p>This method takes one or more class names as its parameter. In the first version, if an element in the matched set of elements already has the class, then it is removed; if an element does not have the class, then it is added. For example, we can apply <code>.toggleClass()</code> to a simple <code>&lt;div&gt;</code>: </p>
4143
<pre><code>
4244
&lt;div class="tumble"&gt;Some text.&lt;/div&gt;

0 commit comments

Comments
 (0)