OLD | NEW |
1 part of html_common; | 1 part of html_common; |
2 | 2 |
3 convertDartToNative_PrepareForStructuredClone(value) => | 3 convertDartToNative_PrepareForStructuredClone(value) => |
4 new _StructuredCloneDartium().convertDartToNative_PrepareForStructuredClone(
value); | 4 new _StructuredCloneDartium().convertDartToNative_PrepareForStructuredClone(
value); |
5 | 5 |
6 convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) => | 6 convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) => |
7 new _AcceptStructuredCloneDartium().convertNativeToDart_AcceptStructuredClon
e(object, mustCopy: mustCopy); | 7 new _AcceptStructuredCloneDartium().convertNativeToDart_AcceptStructuredClon
e(object, mustCopy: mustCopy); |
8 | 8 |
9 class _StructuredCloneDartium extends _StructuredClone { | 9 class _StructuredCloneDartium extends _StructuredClone { |
10 newJsMap() => new js.JsObject(js.context["Object"]); | 10 newJsMap() => new js.JsObject(js.context["Object"]); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 var defaultNS = jsObject['namespaceURI'] == 'http://www.w3.org/1999/xhtml' |
| | 169 var defaultNS = jsObject['namespaceURI'] == 'http://www.w3.org/1999/xhtml' |
| |
170 jsObject['namespaceURI'] == 'http://www.w3.org/2000/svg'; | 170 jsObject['namespaceURI'] == 'http://www.w3.org/2000/svg'; |
171 if (customElementClass != null && extendsTag == "" && defaultNS) { | 171 if (customElementClass != null && extendsTag == "" && defaultNS) { |
172 // The customElementClass is known but we can't create the real class so | 172 // The customElementClass is known but we can't create the real class so |
173 // create the HtmlElement and it will get upgraded when registerElement's | 173 // create the HtmlElement and it will get upgraded when registerElement's |
174 // createdCallback is called. | 174 // createdCallback is called. |
175 func = getHtmlCreateFunction('HTMLElement'); | 175 func = getHtmlCreateFunction('HTMLElement'); |
176 } else { | 176 } else { |
177 func = getHtmlCreateFunction(jsTypeName); | 177 func = getHtmlCreateFunction(jsTypeName); |
178 if (func == null) { | 178 if (func == null) { |
179 if (jsTypeName == 'auto-binding') { | 179 // Start walking the prototype chain looking for a JS class. |
180 func = getHtmlCreateFunction('HTMLTemplateElement'); | 180 var prototype = jsObject['__proto__']; |
181 } else if (jsObject.toString() == "[object HTMLElement]") { | 181 var keepWalking = true; |
182 // One last ditch effort could be a JS custom element. | 182 while (keepWalking && prototype.hasProperty('__proto__')) { |
183 func = getHtmlCreateFunction('HTMLElement'); | 183 prototype = prototype['__proto__']; |
| 184 if (prototype != null && prototype is Element && |
| 185 prototype.blink_jsObject != null) { |
| 186 // We're a Dart class that's pointing to a JS class. |
| 187 var blinkJso = prototype.blink_jsObject; |
| 188 jsTypeName = blinkJso['constructor']['name']; |
| 189 func = getHtmlCreateFunction(jsTypeName); |
| 190 keepWalking = func == null; |
| 191 } |
184 } | 192 } |
185 } | 193 } |
186 } | 194 } |
187 | 195 |
188 // Can we construct a Dart class? | 196 // Can we construct a Dart class? |
189 if (func != null) { | 197 if (func != null) { |
190 dartClass_instance = func(); | 198 dartClass_instance = func(); |
191 | 199 |
192 // Wrap our Dart instance in both directions. | 200 // Wrap our Dart instance in both directions. |
193 dartClass_instance.blink_jsObject = jsObject; | 201 dartClass_instance.blink_jsObject = jsObject; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 380 |
373 final js.JsArray blink_jsObject; | 381 final js.JsArray blink_jsObject; |
374 | 382 |
375 operator [](int index) => wrap_jso(js.JsNative.getArrayIndex(blink_jsObject, i
ndex)); | 383 operator [](int index) => wrap_jso(js.JsNative.getArrayIndex(blink_jsObject, i
ndex)); |
376 | 384 |
377 operator []=(int index, value) => blink_jsObject[index] = value; | 385 operator []=(int index, value) => blink_jsObject[index] = value; |
378 | 386 |
379 int get length => blink_jsObject.length; | 387 int get length => blink_jsObject.length; |
380 int set length(int newLength) => blink_jsObject.length = newLength; | 388 int set length(int newLength) => blink_jsObject.length = newLength; |
381 } | 389 } |
OLD | NEW |