GithubHelp home page GithubHelp logo

Class'n'ID shortand about html6 HOT 4 CLOSED

oscargodson avatar oscargodson commented on June 10, 2024
Class'n'ID shortand

from html6.

Comments (4)

OscarGodson avatar OscarGodson commented on June 10, 2024

It's cool, but it's not backwards compatible at all. Tags don't allow special characters so browsers would have to do a ton of work to get this to work correctly. In the meantime your code wouldn't fall back either while browsers were upgraded. There'd be no way to select this with CSS and CSS would also have to add support. It's neat, but take a lot of work.

from html6.

m93a avatar m93a commented on June 10, 2024

Nothing of HTML6 is back compatibile. It's only a question of importing new DOM parser, everything else will work the same old way. If you don't like it because of difficulty of importing, I can tell you it's not difficult :)
But when I think about it, the class deffinitions are ugly. But that id syntax could be only a shortand for id attribute - the element will parse as if it had id="..." attr. Not much work to implement, huh?

from html6.

OscarGodson avatar OscarGodson commented on June 10, 2024

Yes :)

Simple example:

<foo id="test" class="test"></foo>
<html:foo id="test" class="test"></foo>
<foo id="test" class="test">

With JS or CSS you can interact with those elements fine. Notice how GitHub event colors them correctly. Browser still renders the text inside those elements fine and, basically, these work just like any other HTML tag.

<b#bold1.mark.foo foo="bar">quz</b>

Not will all code highlighters fail (editors, web ones like this, etc), but browsers wont know what to do with it, Have you tried opening something like this in Chrome?

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <b test="test">hkj</b>
  <a#bold1.mark.foo test="test">quz</b>

 <script>
  console.log(document.querySelector('[test]')); // Only returns 1
 </script>
</body>
</html>

You would need to write a shim to all of the DOM JS APIs because, to JS, that element doesn't even exist. You'd have to get the body innerHTML and parse it manually. Of course it could be done, but you would have to write a parser before you could use this whereas HTML6 now CSS and JS works fine and writing a shim just means converting a few tags to other tags, but you get all the other stuff free.

from html6.

m93a avatar m93a commented on June 10, 2024

Ok, let's close this discussion.

from html6.

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.