Jump to content

Do you want HTML5 be more seperated from the DOM?


J-F
 Share

Recommended Posts

Hey everybody,

I love HTML5 especially because it runs everywhere. I've been really into Cocoon.js and it seems like that the canvas is going to be seperated more and more from the DOM. For example I found it really bugging to create a new DOM-Image-Object, that is ment to be used in the DOM, to render an image to the canvas, because properties like "align" and "border" become obsolete. Of course there are other examples like the audio tag, ... 

 

When developers of new plattforms don't have to worry about some sillinesses of the DOM, the canvas and HTML5 could get more popular and could also be hardware-accelerated.

What is your opinion on this topic?

 

Greetings, J-F

Link to comment
Share on other sites

My opinion is that you seem to be confused about the topic and mix up things.

 

You cannot abstract away the DOM to make "HTML5" more popular, because the DOM is a fixed part that belongs to the whole ecosystem. The DOM is the collection of objects generated by the browser when the HTML has been interpreted and turned into objects. The DOM is the thing you can address with JavaScript to manipulate the objects that have been generated from the HTML text.

 

You cannot abstract that away.

 

What you do in JavaScript when you want to load an image is that you DIRECTLY create a image object by calling new Image() and then setting the properties like "src".

Exactly that happens as well when you place a <img> tag in your HTML source, only that the browser "reads" the HTML text and creates objects out of that source.

 

I hope this helps you understanding the topic a bit better.

Link to comment
Share on other sites

@Chris

Thanks for your answer, but I don't think that you know what I ment.

 

I think I understood the DOM and its functions very well and see why it is so important in a normal website. But the latest development in the JavaScript community show that there is a demand for hardware accelerated games to give the feeling of native apps on mobile plattforms. For me it could make sense to leave the website-document and give the programmer a feeling he is used to in non-web languages and frameworks. Many things in canvas are directly related to the webbrowser, although I could imagine using JavaScript without the context of a webbrowser aswell.

 

Greetings, Jan

Link to comment
Share on other sites

there is one important thing you forget : wrappers like Cocoonjs or ejecta, drop DOM support to gain some performance because the present mobile browser implementations still have performance issues when both DOM and canvas/WebGL are rendered. also, those engines add better support to some HTML5 features that are not fully implemented on mobile browsers (take webaudio as example).

when all mobile browsers will become mature and fix most of performance issues, I'll be using wrappers that give me access to DOM, since implementing GUI/HUD is mutch simpler with DOM.

IMO, the power of HTML5 it that it give you both choices, you can completely drop the dom stuff and use it as a JS only framework, but you can also profit from some cool possibilities that HTML/CSS3 provide.
 

Link to comment
Share on other sites

Sooo... when you don't want to use HTML5, then why are you using it? Just write your game in objective-C and the likes to have native performance and remove all the abstraction and flexibility you criticise on HTML5 to make it "slow". Problem solved.

Link to comment
Share on other sites

That sounds great Chris, but it isn't practical. If you want to go that route as an indie developer, you would have to know Objective-C for iOS, Java for Android, and others for Windows.

 

I have no idea what the OP is talking about, but it would be really nice to have an HTML canvas that is nothing but a direct Open-GL view to hardware. I don't get why we need different browsers to "support the canvas" in unique ways. Why can't we just have a standard for a change.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...