Skip to content

Content inside <template> breaks extending <body> element. #421

Description

@tomalec

I wrote a custom element that extends <body> (http://jsbin.com/vohoc/1/edit). It worked perfectly fine in both Canary and regular Chrome (http://jsbin.com/cepew/2/quiet).

But when I put anything into element's template:

<polymer-element name="x-foo" extends="body">
  <template>Something here breaks it.<content></content></template>

http://jsbin.com/cepew/3/quiet

It blows with a ton of Uncaught Error: Assertion failed errors. Two at the beginning at PointerGestureEvent.js:18, and throws one for every mouse move.
(Chrome 32.0.1700.107 m)

Activity

  1. sorvell commented on Feb 18, 2014

    @sorvell
    Contributor

    I don't have Chrome32 to test on but do yo mind verifying this repro's with
    the latest polymer release? I don't see a problem on Safari, FF, Chrome 33,
    or Chrome 34.

    Thanks.

    On Fri, Feb 14, 2014 at 4:57 AM, Tomek Wytrębowicz <notifications@github.com

    wrote:

    I wrote a custom element that extends (
    http://jsbin.com/vohoc/1/edit). It worked perfectly fine in both Canary
    and regular Chrome (http://jsbin.com/cepew/2/quiet).

    But when I put anything into element's template:

    Something here breaks it.

    http://jsbin.com/cepew/3/quiet

    It blows with a ton of Uncaught Error: Assertion failed errors. Two at
    the beginning at PointerGestureEvent.js:18, and throws one for every mouse
    move.
    (Chrome 32.0.1700.107 m)

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/421
    .

  2. sorvell commented on Feb 18, 2014

    @sorvell
    Contributor

    Oh, and kudos for using a jsbin as an HTMLImport =)

    On Tue, Feb 18, 2014 at 10:34 AM, Steve Orvell sorvell@google.com wrote:

    I don't have Chrome32 to test on but do yo mind verifying this repro's
    with the latest polymer release? I don't see a problem on Safari, FF,
    Chrome 33, or Chrome 34.

    Thanks.

    On Fri, Feb 14, 2014 at 4:57 AM, Tomek Wytrębowicz <
    notifications@github.com> wrote:

    I wrote a custom element that extends (
    http://jsbin.com/vohoc/1/edit). It worked perfectly fine in both Canary
    and regular Chrome (http://jsbin.com/cepew/2/quiet).

    But when I put anything into element's template:

    Something here breaks it.

    http://jsbin.com/cepew/3/quiet

    It blows with a ton of Uncaught Error: Assertion failed errors. Two at
    the beginning at PointerGestureEvent.js:18, and throws one for every mouse
    move.
    (Chrome 32.0.1700.107 m)

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/421
    .

  3. tomalec commented on Feb 18, 2014

    @tomalec
    ContributorAuthor

    :) Thanks.

    I still face same issue on
    Chrome 32 - http://imgur.com/kp55nrF
    Firefox 26.0

  4. sorvell commented on Feb 20, 2014

    @sorvell
    Contributor

    I'm unable to reproduce this now (see below) on Chrome 32 (Version 32.0.1700.107 m). Sorry, but can you verify one more time?

    The test is loading polymer directly via github. This, unfortunately (or not) makes it a moving target as this build is frequently updated.

    If the problem persists, can you include any Chrome flags that are set (you can go to chrome://version and paste the output next to 'Command Line'). Thanks for your patience.

  5. tomalec commented on Mar 3, 2014

    @tomalec
    ContributorAuthor

    I have fixed Polymer version to latest baster hash http://jsbin.com/cepew/5/edit
    I still face this issue once I open chrome devtools.

    chrome://version

    Google Chrome   33.0.1750.117 (Oficjalna wersja 252094) m
    OS  Windows 
    Blink   537.36 (@167220)
    JavaScript  V8 3.23.17.13
    Flash   12.0.0.70
    Client  Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36
    Command Line    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --no-startup-window --flag-switches-begin --flag-switches-end
    
  6. sorvell commented on Aug 11, 2014

    @sorvell
    Contributor

    This seems to work on Chrome now:

    http://jsbin.com/beyuy/1/edit

    @arv and @jmesserly It doesn't appear to work with the ShadowDOM polyfill.

  7. arv commented on Aug 12, 2014

    @arv
    Contributor

    I really do not see why this would be different than say a div. I think the first step would be to see if this repros in a pure ShadowDOM polyfill.

  8. jmesserly commented on Aug 13, 2014

    @jmesserly
    Contributor

    ah, tracked it down. It breaks because this line:
    https://github.com/Polymer/ShadowDOM/blob/master/src/ShadowRenderer.js#L76
    expects to be operating on the unwrapped node. But when it calls insertBefore, it gets the overridden method due to https://github.com/Polymer/ShadowDOM/blob/master/src/wrappers/Document.js#L234
    and that expects wrappers (https://github.com/Polymer/ShadowDOM/blob/master/src/wrappers/Node.js#L369)

    Not sure the best fix. We could capture the native insertBefore method as "originalInsertBefore" and call that directly from ShadowRenderer to ensure we're getting the native one. Not sure if there's any other way to reliably get the native (visual) methods for "body", since they're all overridden.

    Thoughts?

  9. jmesserly commented on Aug 13, 2014

    @jmesserly
    Contributor

    By the way, here's a 1-page repro: http://jsbin.com/bitebohovezo/1/edit
    It works if you s/body/div/

  10. arv commented on Aug 13, 2014

    @arv
    Contributor

    Storing the original function is what we had to do in a few other places.

  11. jmesserly commented on Aug 27, 2014

    @jmesserly
    Contributor

    simplified the repro a bit further (just platform.js now): http://jsbin.com/bitebohovezo/2/edit
    working on a test case + fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions