Custom Elements that are not presentable

65 views
Skip to first unread message

Marcin Warpechowski

unread,
Jun 12, 2014, 8:54:16 AM6/12/14
to polym...@googlegroups.com
It all started when I wanted to write some non-presentable Custom Elements be able to find them in DOM using some generic rule. 

Polymer has plenty of such elements: <polymer-ajax>, etc. Polymer demos have them as well: Polymer/TodoMVC has <td-model> for example.

Even HTML has elements that are not presentable: SCRIPT, STYLE, LINK, BASE, META, etc - and recently TEMPLATE.

W3C HTML5 spec is not very clear about such elements and what makes them non-presentable. It seems that presentable elements are those categorised as Flow Content (or Palpable Content - anyone can describe the difference?). Non-presentable are sometimes categorised as Metadata Content (e.g. SCRIPT, TEMPLATE) or not categorised at all (e.g. SOURCE, TRACK)

How can I reliably define (and later check) that a Custom Element is not meant for presentation? 

I checked sources of <polymer-ajax> and it seems that this issue was not yet addressed there. <polymer-xhr> has <style>:host { display: none}</style> which looks like a cheat because I cannot determine if "display: none" is just temporary style or intended permanent property.

I want to write few non-presentable Custom Elements and I am considering extending LINK or META elements for that matter, because this let's me accurately determine that these elements are not meant for presentation.

Any other ideas?

Tomek W

unread,
Jun 12, 2014, 9:10:16 AM6/12/14
to polym...@googlegroups.com
Recently I made a Custom Element that extends Template, so other apps/elements may treat it as native one. As for now it serves well.
I am not sure if this should be considered as good practice, but for me it look quite nice from semantics point of view to use Link as well, if the component also specifies some kind of relationship between resources.

Anyway, we could imagine components that have nothing to do with native ones, but still should not be considered as presentable.
Therefore it would be nice to have a unified, standard way to define, and determine it.

Eric Bidelman

unread,
Jun 12, 2014, 1:09:11 PM6/12/14
to Tomek W, polymer-dev
display: none is intentional and is based off what the native non-visual UA elements do: 


It's worth noting that in some cases, an element may be both visual and non-visual. <audio>/</video> are good examples. You opt-in to the controls. But by default, they provide their utility without UI.



Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/abb4d45a-e1fc-47da-8298-6a90b3ef425d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages