GithubHelp home page GithubHelp logo

Cannot parse <HTML> element. about jquery HOT 5 CLOSED

jquery avatar jquery commented on May 22, 2024
Cannot parse element.

from jquery.

Comments (5)

mjesun avatar mjesun commented on May 22, 2024

jQuery version 2.1.0, browser version: Google Chrome 35.0.1916.153.

from jquery.

markelog avatar markelog commented on May 22, 2024

From http://api.jquery.com/jQuery/ -

When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, jQuery uses the browser's .innerHTML property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as , <title>, or elements. As a result, the elements inserted may not be representative of the original string passed.

from jquery.

mjesun avatar mjesun commented on May 22, 2024

That seems a bit strange for me; you could argue the same for elements, but instead they are parsed by wrapping them up into something, so they are correctly transformed into DOM elements (see https://github.com/jquery/jquery/blob/master/src/manipulation.js#L33).

So my guess is that special cases like <HTML> should also have their special strategy to be parsed.

from jquery.

markelog avatar markelog commented on May 22, 2024

If you have an idea how to fix this - please share it, we happy to consider any proper PR

from jquery.

dmethvin avatar dmethvin commented on May 22, 2024

@mjesun Keep in mind though that the need to create a full HTML document starting at a element is pretty rare. The cases you pointed out that we currently fix are not rare, and our attempts at fixing them are not bulletproof but usually sufficient. If you really need to create a full document, take a look at DOMImplementation.createHTMLDocument.

from jquery.

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.