Giter VIP home page Giter VIP logo

Comments (2)

andyjcross avatar andyjcross commented on June 6, 2024

looks like this was addressed. cool.

from template-html.

treshugart avatar treshugart commented on June 6, 2024

Hey, sorry I never responded to this. I did see it but admittedly forgot to get back to you.

In short, yes, this is being rectified. The current implementation in master is changing and is considered unstable, though the tests pass. I'm currently exploring the best way to do this.

The long answer is that simply overriding prototypes doesn't seem to be a viable option. It would be the best option if Webkit didn't have this bug that prevents one from getting the native accessor implementations using getOwnPropertyDescriptor(). Even if that would be possible, Webkit has a bug where you're not allowed to override built-in property descriptors.

Due to these bugs, you have to re-implement, from scratch, the behaviour of things like innerHTML and manually keep track of childNodes, parentNode et al. Manually re-implementing innerHTML is possible using DOMParser, but that requires that you leave the HTMLBodyElement prototype untouched because internally the DOMParser implementation expects all native implementations to be intact in order for you to retrieve the parsed DOM content off the parser result. Basically, you have to modify all element constructors except for the body element.

This is all well and good until you realise that not all HTML elements have their own constructor and that some simply derive from HTMLElement directly. This means that in order to do everything through prototype overrides, one must be able to override HTMLElement.prototype. Due to the Webkit bugs, this simply isn't an option.

The solution, which I am elaborating on is using wrapper objects similar to the Polymer polyfill. Eventually we might be able to use a hybrid approach, but I anticipate that becoming very dirty, very quickly.

from template-html.

Related Issues (5)

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.