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

Needs client side polyfill #2

Open
OscarGodson opened this issue Aug 20, 2012 · 9 comments
Open

Needs client side polyfill #2

OscarGodson opened this issue Aug 20, 2012 · 9 comments

Comments

@OscarGodson
Copy link
Owner

No description provided.

@cshaa
Copy link
Contributor

cshaa commented Sep 18, 2013

I've made a little parser in JavaScript. It's not finished yet.
http://github.com/m93a/nml-parser

EDIT: Updating to 1.1.0, now it can export DOMDocument.

It's just a parser but it can be used:

  • to make a html6-html5 convertor
  • as a node.js html6 module
  • in a browser extension for html6 compatibility
  • to use NML in ajax, instead of XML
  • to make your disk 20kB smaller
  • and much more...

@OscarGodson
Copy link
Owner Author

Looks really cool. Hope to see more :)

@cshaa
Copy link
Contributor

cshaa commented Sep 21, 2013

But before html6-html5 convertor, we need a CSS parser. And maybe a JS framework.

@OscarGodson
Copy link
Owner Author

Why do we need a CSS parser? CSS works fine with XML. And why a whole framework?

@cshaa
Copy link
Contributor

cshaa commented Sep 22, 2013

OK, we can use xhtml with both html and form namespace prefixes set to http://www.w3.org/1999/xhtml. There is just a problem with splitting media tag to img, video and audio.
We have to:

  • rewrite all the CSS selectors (media -> img, video, audio and #foo -> [id=foo])
  • make document.getElementsByTagNameNS('media',"http://www.w3.org/1999/xhtml"); select img, video and audio

Oh and also there's a problem with programmatically creating elements with ns prefix. That's impossible!

This comment was editted 5 times.

@OscarGodson
Copy link
Owner Author

CSS selectors need to be general and work across XML. CSS doesn't have predefined elements you can select for example. You can style those elements fine right now: http://jsbin.com/iCuDEYE/2/edit

The only thing I can think of is adding 1 selector to make html\:foo a little nicer to write. I'm not sure what you mean by your 2nd example of the ID.

The JS thing should just be part of the polyfill.

@cshaa
Copy link
Contributor

cshaa commented Sep 23, 2013

I don't mean creating a new spec - our problem is that all media tags will be replaced by a) img b) audio or c) video tag so your styles won't match any element. I don't see any way to make media tag work without changing DOM. That means that the convertor has to change every html:media to img, video or audio.

And the second problem with css is that #foo doesn't work with xml (in all modern browsers - that means all the browsers but MSIE).

Do you understand?

EDIT: Oops, to fast reading. I thought you said that CSS works across all the XML. My fault, correcting the comment.

@cshaa
Copy link
Contributor

cshaa commented Sep 23, 2013

I've just found an alternative way

  1. Leave html:media unchanged
  2. Add a tag like abc:xyz at the end of the body element
  3. Choose the type of media tag (image, video or audio)
  4. Create image, video or audio tag as a child of abc:xyz
  5. Make the video/audio/image tag cover the media using javascript and css absolute position

Pros:

  • no css modifications needed
  • no JS framework needed

Cons:

  • not a valid xHTML
  • abc:xyz can be still detected using JavaScript
  • media's computed styles have to be checked every hunderth of a second (not exactly :D)
  • no animation and transition support

@cshaa
Copy link
Contributor

cshaa commented Sep 18, 2014

After a short break (not even a year), I've got a new update!
HTML6 Polyfill Beta can be found at m93a/nml-polyfill.

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