Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor text edits on DOM API description #1281

Merged
merged 1 commit into from
Mar 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions PRIMER.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ Example:
<a name="dom-api"></a>
## DOM API

Polymer provides custom API for manipulating dom such that local DOM and light DOM trees are properly maintained.
Polymer provides custom API for manipulating DOM such that local DOM and light DOM trees are properly maintained.

**<div style="color:red">Note: All DOM manipulation must use this API, as opposed to DOM API directly on nodes.</div>**

Expand All @@ -425,7 +425,9 @@ The following methods are provided:
* `Polymer.dom(node).getDestinationInsertionPoints()`
* `Polymer.dom.flush()` - The insert, append, and remove operations are trasnacted lazily in certain cases for performance. In order to interrogate the dom (e.g. `offsetHeight`, `getComputedStyle`, etc.) immediately after one of these operations, call `Polymer.dom.flush()` first.

Calling `append`/`insertBefore` where parent is a custom Polymer element adds the node to the light DOM of the element. In order to insert/append into the shadow root of a custom element, use `this.root` as the parent.
Calling `append`/`insertBefore` where `parent` is a custom Polymer element adds the node to the light DOM of the element. In order to insert/append into the shadow root of a custom element, use `this.root` as the parent.

`Polymer.dom` properties and methods that return a list of nodes return an `Array`, not a `NodeList` like the standard DOM equivalent.

Example:

Expand All @@ -440,7 +442,7 @@ Polymer.dom(this.root).insertBefore(toLocal, beforeNode);
var allSpans = Polymer.dom(this).querySelectorAll('span');
```

For manipulating dom in elements that themselves do not have local dom, the above api's support an extra argument which is the container `node` in which the operation should be performed.
You can use `Polymer.dom` on any node, whether or not it has a local DOM tree:

Example:

Expand Down