Closure Compiler定义{Element}和{HTMLElement},{Document}和{HTMLDocument}。我应该如何选择使用哪一个来充分利用Closure Compiler?
它们并不是一回事。有时一个会导致Closure Compiler错误消息,而另一个则不会。有时一个可以用在一个有效的Closure Compiler" cast"对方无法做到。
(也许差异与DOM1与DOM2有关,但是什么?[为什么这很重要?]我是否应该总是在Javascript中使用一个或另一个只能在HTML5上运行?)
答案 0 :(得分:0)
除非在代码使用中使用Element
特定属性,否则请使用HTMLElement
。
HTMLElement specific properties:
HTMLElement.accessKey
HTMLElement.accessKeyLabel (Read only)
HTMLElement.contentEditable
HTMLElement.contextMenu
HTMLElement.dir
HTMLElement.draggable
HTMLElement.dropzone (Read only)
HTMLElement.hidden
HTMLElement.inert
HTMLElement.innerText
HTMLElement.isContentEditable (Read only)
HTMLElement.itemId
HTMLElement.itemProp (Read only)
HTMLElement.itemRef (Read only)
HTMLElement.itemScope
HTMLElement.itemType (Read only)
HTMLElement.itemValue
HTMLElement.lang
HTMLElement.noModule
HTMLElement.offsetHeight (Read only)
HTMLElement.offsetLeft (Read only)
HTMLElement.offsetParent (Read only)
HTMLElement.offsetTop (Read only)
HTMLElement.offsetWidth (Read only)
HTMLElement.properties (Read only)
HTMLElement.spellcheck
HTMLElement.style
HTMLElement.title
HTMLElement.translate
HTMLElement.oncopy
HTMLElement.oncut
HTMLElement.onpaste
TouchEventHandlers.ontouchstart
TouchEventHandlers.ontouchend
TouchEventHandlers.ontouchmove
TouchEventHandlers.ontouchenter
TouchEventHandlers.ontouchleave
TouchEventHandlers.ontouchcancel
HTMLElement.attachInternals()
HTMLElement.click()
HTMLElement.forceSpellCheck()