RE: Custom element design with ES6 classes and Element constructors

From: Elliott Sprehn [mailto:esprehn@google.com] 

> Perhaps, but that logically boils down to "never use string properties ever" just in case some library conflicts with a different meaning. We'd have $[jQuery.find](...) and so on for plugins.

Nah, it boils down to "don't use string properties for meta-programming hooks."

> Or more concretely isn't the new DOM Element#find() method going to conflict with my <polymer-database>'s find() method? So why not make that [Element.find] so polymer never conflicts?

You can overwrite methods on your prototype with no problem. The issue comes when the browser makes assumptions about what user-supplied methods (i.e., metaprogramming hooks) are supposed to behave like. 

More concretely, if there was browser code that *called* arbitraryElement.find(), then we'd be in a lot more trouble. But as-is we're not.

(BTW find() was renamed to query(), IIRC because of conflicts with HTMLSelectElement or something?)

Received on Wednesday, 28 January 2015 05:32:56 UTC