-
Notifications
You must be signed in to change notification settings - Fork 31
Inline <script type="text/markdown"> not picked up in ready() #55
Description
Description
TL;DR
var markdownElement = Polymer.dom(this).querySelector('[type^="text/markdown"]');
In Chrome, this line in the ready() callback returns null unexpectedly.
Long Version
Ok I've tried to reproduce this in isolation but I'm having difficulty so I will have to try and explain as best I can.
Environment:
- Heavily developed instance of the Polymer Starter Kit for an internal element gallery.
- Polymer 1.8.1 using webcomponents-lite.js and shady dom.
Markup:
<paper-material>
<p>A horizontal layout:</p>
<my-layout orientation="horizontal">
<my-pane></my-pane>
<my-pane></my-pane>
<my-pane></my-pane>
</my-layout>
<marked-element id="1">
<script type="text/markdown">
```
TEST 1
```
</script>
</marked-element>
<marked-element id="2">
<script type="text/markdown">
```
TEST 2
```
</script>
</marked-element>
</paper-material>
<paper-material>
<p>A horizontal layout:</p>
<my-layout orientation="horizontal">
<my-pane></my-pane>
<my-pane></my-pane>
<my-pane></my-pane>
</my-layout>
<marked-element id="3">
<script type="text/markdown">
```
TEST 3
```
</script>
</marked-element>
<marked-element id="4">
<script type="text/markdown">
```
TEST 4
```
</script>
</marked-element>
</paper-material>
Given four marked-elements with the exact same markup (copied-pasted) , the 3rd marked-element does not render at all. I have put the following tracing in:
In the ready() method the following line unexpectedly returns null:
var markdownElement = Polymer.dom(this).querySelector('[type^="text/markdown"]');
Observations:
- It only happens in Chrome. IE, Edge and Firefox all exhibit the expected behaviour.
- It appears to be a timing issue. Attaching the debugger seems to give Chrome a chance to catch up and it works as expected.
- It seems to be sensitive to the surrounding markup, removing different portions of surrounding markup changes which
marked-element(1,2,3,4) does not get rendered.
Expected outcome
All marked-elements get rendered.
Actual outcome
A pseudo-random marked-element does not get rendered, seemingly dependent on the rest of the document.
Browsers Affected
- [ x ] Chrome
- Firefox
- Safari 9
- Safari 8
- Safari 7
- Edge
- IE 11
- IE 10
