mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This CL implements custom elements. The design is as follows:
1) Authors subclass Element and call registerElement.
2) When we create C++ elements for custom elements, we call the author's
constructor synchronously.
3) The attach/detach/attributeChanged callbacks are called either:
a) when exiting the current custom element callback scoped (e.g., before
returning from appendChild), or
b) when draining the microtask queue.
The implementation in this CL is a bit fragile because we don't detect name
registration conflicts and we let you create custom elements with the same name
as built-in elements. Also, not every part of the engine is prepared to execute
script synchronously below createElement. We'll need to iron out these issues
over time, but this CL is a start.
R=ojan@chromium.org
Review URL: https://codereview.chromium.org/943013002
25 lines
1.0 KiB
Plaintext
25 lines
1.0 KiB
Plaintext
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
interface Node : EventTarget {
|
|
Node cloneNode([Named] optional boolean deep = true);
|
|
|
|
readonly attribute ParentNode owner;
|
|
readonly attribute ParentNode parentNode;
|
|
readonly attribute Element parentElement;
|
|
|
|
readonly attribute Node nextSibling;
|
|
readonly attribute Node previousSibling;
|
|
readonly attribute Element nextElementSibling;
|
|
readonly attribute Element previousElementSibling;
|
|
|
|
[CustomElementCallbacks, RaisesException, ImplementedAs=newInsertBefore] void insertBefore(sequence<Node> nodes);
|
|
[CustomElementCallbacks, RaisesException, ImplementedAs=newInsertAfter] void insertAfter(sequence<Node> nodes);
|
|
[CustomElementCallbacks, RaisesException] void replaceWith(sequence<Node> nodes);
|
|
|
|
[CustomElementCallbacks, RaisesException] void remove();
|
|
|
|
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString textContent;
|
|
};
|