Nice!

I tweaked <http://jsbin.com/ririweqosepe/1/edit> this a bit to make it more
robust. Also create a handy bookmarklet
<https://gist.github.com/ebidel/cea24a0c4fdcda8f8af2>.

- adjusted to work with multiple-levels of shadow dom
- works with is="" custom elements
- el.constructor == HTMLElement returns false positives for <header> and
other elements, so I'm getting everything with
document.querySelectorAll('html /deep/ *') instead, then filtered on valid
custom element names.


On Wed, Sep 10, 2014 at 1:32 PM, Aleks Totic <[email protected]> wrote:

> I've just spent a couple of hours tracking down a layout bug that turned
> out to be a missing core-header-panel import. I am always nervous about
> missing imports when coding Polymer. So I wrote a little utility that
> reports unresolved HTML elements as errors. In case anyone else finds it
> useful, here is the script:
>
>      function findUnknownElements(el) {
>         if (el.constructor == HTMLElement)
>           console.error("Found unknown element:", el);
>         if (el.shadowRoot) {
>           var every = el.shadowRoot.querySelectorAll('*');
>           for (var i=0; i<every.length; i++)
>             findUnknownElements(every[i]);
>         }
>       }
>       document.addEventListener('polymer-ready', function() {
>         var every = document.querySelectorAll('*');
>         for (var i=0; i<every.length; i++)
>           findUnknownElements(every[i]);
>       });
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/9b4ed352-5167-4473-9bba-f3ac2b67c7a7%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/9b4ed352-5167-4473-9bba-f3ac2b67c7a7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CACGqRCAJ5sET8DnVCrUVwfhMeQ_4V2-DUL%2BaSW7vBpcD3RG8pA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to