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

Side by Side Diff: tools/dom/templates/html/impl/impl_Document.darttemplate

Issue 1310363006: Patched in Dartium JsInterop (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 @DocsEditable() 7 @DocsEditable()
8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node 8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node
9 { 9 {
10 10
11 $!MEMBERS 11 $!MEMBERS
12 /** 12 /**
13 * Finds all descendant elements of this document that match the specified 13 * Finds all descendant elements of this document that match the specified
14 * group of selectors. 14 * group of selectors.
15 * 15 *
16 * Unless your webpage contains multiple documents, the top-level 16 * Unless your webpage contains multiple documents, the top-level
17 * [querySelectorAll] 17 * [querySelectorAll]
18 * method behaves the same as this method, so you should use it instead to 18 * method behaves the same as this method, so you should use it instead to
19 * save typing a few characters. 19 * save typing a few characters.
20 * 20 *
21 * [selectors] should be a string using CSS selector syntax. 21 * [selectors] should be a string using CSS selector syntax.
22 * 22 *
23 * var items = document.querySelectorAll('.itemClassName'); 23 * var items = document.querySelectorAll('.itemClassName');
24 * 24 *
25 * For details about CSS selector syntax, see the 25 * For details about CSS selector syntax, see the
26 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). 26 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/).
27 */ 27 */
28 ElementList<Element> querySelectorAll(String selectors) { 28 ElementList<Element> querySelectorAll(String selectors) {
29 $if JSINTEROP
30 return _querySelectorAll(selectors);
31 $else
32 return new _FrozenElementList._wrap(_querySelectorAll(selectors)); 29 return new _FrozenElementList._wrap(_querySelectorAll(selectors));
33 $endif
34 } 30 }
35 31
36 /** 32 /**
37 * Alias for [querySelector]. Note this function is deprecated because its 33 * Alias for [querySelector]. Note this function is deprecated because its
38 * semantics will be changing in the future. 34 * semantics will be changing in the future.
39 */ 35 */
40 @deprecated 36 @deprecated
41 @Experimental() 37 @Experimental()
42 @DomName('Document.querySelector') 38 @DomName('Document.querySelector')
43 Element query(String relativeSelectors) => querySelector(relativeSelectors); 39 Element query(String relativeSelectors) => querySelector(relativeSelectors);
(...skipping 19 matching lines...) Expand all
63 59
64 /// *Deprecated*: use [supportsRegisterElement] instead. 60 /// *Deprecated*: use [supportsRegisterElement] instead.
65 @deprecated 61 @deprecated
66 bool get supportsRegister => supportsRegisterElement; 62 bool get supportsRegister => supportsRegisterElement;
67 63
68 @DomName('Document.createElement') 64 @DomName('Document.createElement')
69 Element createElement(String tagName, [String typeExtension]) { 65 Element createElement(String tagName, [String typeExtension]) {
70 $if DART2JS 66 $if DART2JS
71 return _createElement(tagName, typeExtension); 67 return _createElement(tagName, typeExtension);
72 $else 68 $else
73 $if JSINTEROP 69 var newElement = (typeExtension == null) ?
74 return _createElement(tagName, typeExtension); 70 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) :
75 $else 71 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this), tagName, typeExtension);
76 if (typeExtension != null) { 72
77 return _createElement(tagName, typeExtension); 73 var wrapped;
78 } else { 74
79 // Fast-path for Dartium when typeExtension is not needed. 75 if (newElement['dart_class'] != null) {
80 return _Utils.createElement(this, tagName); 76 wrapped = newElement['dart_class']; // Here's our Dart class.
81 } 77 wrapped.blink_jsObject = newElement;
82 $endif 78 } else {
79 wrapped = wrap_jso(newElement);
80 if (wrapped == null) {
81 wrapped = wrap_jso_custom_element(newElement);
82 }
83 }
84
85 return wrapped;
83 $endif 86 $endif
84 } 87 }
85 88
89 @DomName('Document.createElementNS')
90 @DocsEditable()
91 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) {
92 $if DART2JS
93 return _createElementNS(tagName, qualifiedName, typeExtension);
94 $else
95 var newElement = (typeExtension == null) ?
96 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this) , namespaceURI, qualifiedName) :
97 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this) , namespaceURI, qualifiedName, typeExtension);
98
99 var wrapped;
100
101 if (newElement['dart_class'] != null) {
102 wrapped = newElement['dart_class']; // Here's our Dart class.
103 wrapped.blink_jsObject = newElement;
104 } else {
105 wrapped = wrap_jso(newElement);
106 if (wrapped == null) {
107 wrapped = wrap_jso_custom_element(newElement);
108 }
109 }
110
111 return wrapped;
112 $endif
113 }
114
86 $if DART2JS 115 $if DART2JS
87 @DomName('Document.createNodeIterator') 116 @DomName('Document.createNodeIterator')
88 NodeIterator _createNodeIterator(Node root, 117 NodeIterator _createNodeIterator(Node root,
89 [int whatToShow, NodeFilter filter]) 118 [int whatToShow, NodeFilter filter])
90 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', 119 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)',
91 this, root, whatToShow, filter); 120 this, root, whatToShow, filter);
92 121
93 @DomName('Document.createTreeWalker') 122 @DomName('Document.createTreeWalker')
94 TreeWalker _createTreeWalker(Node root, 123 TreeWalker _createTreeWalker(Node root,
95 [int whatToShow, NodeFilter filter]) 124 [int whatToShow, NodeFilter filter])
96 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', 125 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)',
97 this, root, whatToShow, filter); 126 this, root, whatToShow, filter);
98 $endif 127 $endif
99 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698