Giter VIP home page Giter VIP logo

Comments (3)

TheSpyder avatar TheSpyder commented on June 11, 2024

Interesting. We use the browser to parse, and these are actually the attributes it gives us.
new DOMParser().parseFromString('<i gothic",="" sans-serif;"="">test</i>', 'text/html')

And then getAttributeNames() on the i tag returns ['gothic",', 'sans-serif;"']

I'm surprised the browser doesn't strip them, as it is returning names that fail the setAttribute call. A try/catch there shouldn't strip those attributes, but stripping them does seem like what we should be doing.

from tinymce.

jazzmind avatar jazzmind commented on June 11, 2024

I think there are two issues here:

  1. Without the above try catch wrapper the error thrown by setAttribute breaks the script execution in chrome. This prevents tinymce.init() from completing so I just get the three loading dots and no error messages. I've tried using .catch() and wrapping in a try/catch block but I can't prevent execution from breaking.

  2. As you discovered, the browser's own parser seems inconsistent when it comes to invalid attributes. It parses it without error via DOMParser but throws an unrecoverable error via setAttribute.

Given that inconsistency I agree tinymce probably needs to strip invalid attributes or find another way to fail gracefully without breaking execution.

Please let me know if i'm missing something obvious in regard to how to catch the error at init time without the execution flow breaking as a temp solution.

from tinymce.

TheSpyder avatar TheSpyder commented on June 11, 2024

No, you're right, it's something we have to fix in TinyMCE. I can't see any way for you to work around the runtime error without applying regex to the raw source string.

from tinymce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.