Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html code send to prism-highlighter is parsed by polymer #16

Open
3 tasks done
Stefdv opened this issue Apr 26, 2016 · 2 comments
Open
3 tasks done

html code send to prism-highlighter is parsed by polymer #16

Stefdv opened this issue Apr 26, 2016 · 2 comments

Comments

@Stefdv
Copy link

Stefdv commented Apr 26, 2016

Description

code send to prism-highlighter element is actually 'parsed' by polymer.
used prism-demo as example
https://github.com/PolymerElements/prism-element/blob/master/demo/prism-demo.html
<dom-module id="my-element">
<template>
console.log('hello world")
</template>
</dom-module>
<my-element></my-element>
<prism-demo code="<my-element></my-element>" lang="html"></prism-demo>

Expected outcome

hello world

Actual outcome

hello world
hello world

Browsers Affected

  • Chrome
  • Firefox
  • [?] Safari 9
  • [?] Safari 8
  • [?] Safari 7
  • Edge
  • [?] IE 11
  • [?] IE 10
@Stefdv Stefdv changed the title html code is parsed by polymer html code send to prism-highlighter is parsed by polymer Apr 26, 2016
@TimvdLippe
Copy link
Contributor

This is also happening with bindings inside <script type="text/markdown">.

@masonlouchart
Copy link

masonlouchart commented Apr 30, 2021

In my case, when I wait a few seconds before passing my HTML to Prism it is not parsed by Polymer. I guess Prism is not ready the first time my element renders and the source code I want to be highlighted is passed.

Workaround: wait 50ms at least for the 1st render.

setTimeout(() => {
    parent.dispatchEvent(event);
    output.innerHTML = event.detail.code;
}, 50);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants