forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext.xml
29 lines (29 loc) · 1.73 KB
/
context.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0"?>
<entry type="property" name="context" return="Element" deprecated="1.10">
<title>.context</title>
<signature>
<added>1.3</added>
</signature>
<desc>The DOM node context originally passed to <code>jQuery()</code>; if none was passed then context will likely be the document.</desc>
<longdesc>
<p>The <code>.context</code> property was deprecated in jQuery 1.10 and is only maintained to the extent needed for supporting <code>.live()</code> in the jQuery Migrate plugin. It may be removed without notice in a future version.</p>
<p>The <code>.live()</code> method for binding event handlers uses this property to determine the root element to use for its event delegation needs.</p>
<p>The value of this property is typically equal to <code>document</code>, as this is the default context for jQuery objects if none is supplied. The context may differ if, for example, the object was created by searching within an <code><iframe></code> or XML document.</p>
<p>Note that the context property may only apply to the elements originally selected by <code>jQuery()</code>, as it is possible for the user to add elements to the collection via methods such as <code>.add()</code> and these may have a different context.</p>
</longdesc>
<example>
<desc>Determine the exact context used.</desc>
<code><![CDATA[
$( "ul" )
.append( "<li>" + $( "ul" ).context + "</li>" )
.append( "<li>" + $( "ul", document.body ).context.nodeName + "</li>" );
]]></code>
<html><![CDATA[
Context: <ul></ul>
]]></html>
</example>
<category slug="internals"/>
<category slug="properties/jquery-object-instance-properties"/>
<category slug="version/1.3"/>
<category slug="deprecated/deprecated-1.10"/>
</entry>