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

Highlighting not working when inside a dom-repeat template #24

Open
1 of 8 tasks
mohanaravind opened this issue Aug 12, 2016 · 1 comment
Open
1 of 8 tasks

Highlighting not working when inside a dom-repeat template #24

mohanaravind opened this issue Aug 12, 2016 · 1 comment

Comments

@mohanaravind
Copy link

mohanaravind commented Aug 12, 2016

Description

Highlighting doesn't work when it is inside a dom-repeat template. Reason being the _highlight method inside prism-highlighter.html never gets called. It will be nicer if we expose the prism API directly as a method on the component. It works if I explicitly use the _highlight method.

Expected outcome

Code highlights

Actual outcome

The tag not getting rendered

Live Demo

https://jsbin.com/vipuxo/2/edit?html,output

Steps to reproduce

Have a prism-element inside a dom-repeat template

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
43081j added a commit to 43081j/prism-element that referenced this issue Oct 5, 2016
Fixes PolymerElements#24 by exposing the highlighter functionality to data-binding and
programatic use.

Also now checks that the host exists before dealing with event listeners.
@eblaine
Copy link

eblaine commented Jul 7, 2017

The internal _highlight method is never called because the prism-highlighter's parent's attach function is called before the prism-highlighter's attach function.

You'll notice that the prism-highlighter's attach function registers _highlight as a handler for the 'syntax-highlight' event, but that event fires in the parent's attach function before the handler is registered.

Potential workaround would be to fire the syntax-highlight event asynchronously, after the highlighter has been attached.

See related issue: Polymer/polymer#4726

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

2 participants