Polymer 1.0:哪些原生方法可用于事件目标?

Polymer 1.0: What native methods are available to event targets?

This documentation 描述了 Polymer 的事件重定向。

根据文档,我使用 Polymer.dom(event).

获得了 "normalized event object" (NEO)

event retargeting documentation nor the API documentation describes what native methods are available (like .getAttribute()). For an example, see Amit's answer to .

都不是

这个规范化事件对象可以使用哪些本机方法?它们记录在哪里?

规范化的事件对象只列出了三个属性:rootTargetlocalTargetpath。前两个是 element/node 对象,而 path 是事件经过的节点数组。您上面的小片段可能会通过使用前两个中的任何一个来解决,但我建议使用 localTarget 代替,因为它是重定向的。

var obj = Polymer.dom(event).localTarget;
var arg = obj.getAttribute('data-foo'); // or obj.dataset.foo

Here is documentation 在 DOM API 上至少包含部分列表。

它包括以下内容。

Polymer.dom(parent).appendChild(node)
Polymer.dom(parent).insertBefore(node, beforeNode)
Polymer.dom(parent).removeChild(node)
Polymer.dom.flush()
Polymer.dom(parent).childNodes
Polymer.dom(node).parentNode
Polymer.dom(node).firstChild
Polymer.dom(node).lastChild
Polymer.dom(node).firstElementChild
Polymer.dom(node).lastElementChild
Polymer.dom(node).previousSibling
Polymer.dom(node).nextSibling
Polymer.dom(node).textContent
Polymer.dom(node).innerHTML
Polymer.dom(parent).querySelector(selector)
Polymer.dom(parent).querySelectorAll(selector)
Polymer.dom(contentElement).getDistributedNodes()
Polymer.dom(node).getDestinationInsertionPoints()
Polymer.dom(node).setAttribute(attribute, value)
Polymer.dom(node).removeAttribute(attribute)
Polymer.dom(node).classList