Git Product home page Git Product logo

Comments (14)

ClemMakesApps avatar ClemMakesApps commented on May 22, 2024

I fixed this issue in my fork: https://github.com/ClemMakesApps/winstore-jscompat
I would submit a pull request but I am not sure if this breaks anything else. I have only tested it in a few applications.

from winstore-jscompat.

panarasi avatar panarasi commented on May 22, 2024

I think a pull request would be great. Can you also sign the Contributor's License Agreement (CLA) for the project here - https://cla.msopentech.com/ ?

from winstore-jscompat.

ClemMakesApps avatar ClemMakesApps commented on May 22, 2024

Sure. I'll definitely do that. My company is busy during the holidays, so I probably won't be able to submit a pull request till January.

from winstore-jscompat.

wbreza avatar wbreza commented on May 22, 2024

Thanks for fixing this. I was going crazy trying to find out where the extra body tags were coming from. This was screwing up any component JS that was referencing document.body as it was pointing to the extra (empty) body tag. I'm looking forward to seeing this PR get into the master source.

from winstore-jscompat.

xirzec avatar xirzec commented on May 22, 2024

I created a fix in #11. @wbreza @Fishes can you give it a try?

from winstore-jscompat.

Fishes avatar Fishes commented on May 22, 2024

The fix works for the specified problem.
But in my project I include WinJS components and these fail with this fix.
Inititalizing the appBar and adding buttons fails at line 133:13 with the error Invallid pointer.
Sorry

from winstore-jscompat.

wbreza avatar wbreza commented on May 22, 2024

Looks like it works for elements that get injected under the body, but it doesn't work when elements are dynamically injected into the HEAD of the page.

For example, when using this with angular, the default style block that angular attempts to injects into the head of the page does not work.

I've created a pull request that fixed it for my case. Take a look and let me know if it looks good.

from winstore-jscompat.

xirzec avatar xirzec commented on May 22, 2024

@Fishes - Looks like there is a problem in AppBar specifically: winjs/winjs#899

@wbreza - How would that work if you are calling innerHTML on a documentElement? Your code will always strip out <body> and <head> tags.

from winstore-jscompat.

wbreza avatar wbreza commented on May 22, 2024

@xirzec - I haven't tested that case. I'll update again when I have some time to test it out.

from winstore-jscompat.

xirzec avatar xirzec commented on May 22, 2024

@wbreza - Can you give an example of what angular is doing to inject styles? I updated #11 with a guess, but I wasn't sure if they were injecting a tag like <style> that document wants to group in <head> but they wanted to put in the <body> or something.

from winstore-jscompat.

xirzec avatar xirzec commented on May 22, 2024

@Fishes - I was wrong about it being an AppBar problem, the problem was actually because AppBar sets an empty string as innerHTML. I updated #11 to work around that as well.

from winstore-jscompat.

wbreza avatar wbreza commented on May 22, 2024

@xirzec - Take a look at the last line of Angular and you'll see they are finding the 'head' element and prepending a style block.

from winstore-jscompat.

xirzec avatar xirzec commented on May 22, 2024

@wbreza Thanks for the pointer. Yep, they're inserting a <style> tag into a <div>'s innerHTML.

from winstore-jscompat.

xirzec avatar xirzec commented on May 22, 2024

@wbreza Alright! I think I have something workable in #11 - it works with Angular, it works with AppBar, it works with a simple div, it works with a new document element.

from winstore-jscompat.

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.