On Sun, Feb 6, 2011 at 2:38 AM, Garrett Smith <dhtmlkitc...@gmail.com>wrote:
> On 2/5/11, Miller Medeiros <lis...@millermedeiros.com> wrote: > > I started the project using markup for everything (stored in separate > files > > and parsed with a template library) and using `innerHTML` to replace the > > content/estate of my application but after a couple days of development I > > started to migrate most of my code to pure DOM, creating most of the > > elements using `document.createElement`... > > > > Sure, and then add innerHTML, right? > yes, if it is a "leaf" node that I know that won't effect any reference to other elements by doing so. > > for my specific case `document.createElement` seems a better approach > since > > I can cache a reference to the created elements (and delete it later > after > > switching content) instead of having to query for them again every time I > > append something to the innerHTML of the parentNode.. (which would make > the > > cached reference point to the wrong element) > > > > Anyone has any thoughts about that? similar experiences? which one should > be > > favored? > > > > PS: the app is only target for iPad, Chrome and Safari. > > OK. I believe that with innerHTML a node reference can be obtained by > using `node.querySelector`. Stick to standards mode, not quirks. > Example: > > var div = document.createElement("div"); > div.innerHTML = buildPane(); > var actuator = div.querySelector("a.actuator"); > > That should work in the browsers you are targeting, AFAIK. Anybody who > believes otherwise or knows of issues please post up, TIA. > yes it does work (at least I didn't experienced any issues related with that), but the kind of problem I'm trying to avoid is when you update the `innerHTML` of a parent node. (which would clone every child element and break my references). > > PS2: the project reminds a little bit this website > > http://www.wrangler-europe.com/wrangler/ - since I have a fullscreen > > That took too long to load for me. > yes, I agree it's huge... mine the load time shouldn't be that bad since the video is way smaller (unless you are on 3G). > interactive video as well and almost no copy. > > Well I don't like that type of site at all. I prefer pages with clear > readable (largish) text with a few images. I don't like video unless > it is a particular video that I chose to watch and I hate it when > sites paly video or audio when I don't ask for it. Man like when > you're watching a site and all of a sudden it is blaring out I either > frantically clicking mute button or close the window or navigate away. > It can be really embarrassing. > > WCAG talks about prerecorded audio and video. > http://www.w3.org/TR/WCAG20/ > > I would explain the problems with that to the client in writing. They > may have signed off on that design but you should make sure they know > about the consequences of doing that. > > Well at least take care to watch out for a11y issues so that users > aren't blocked. > I know a lot of people don't like this kind of website, and that's one of the reasons why people hates Flash, but the idea/design won't change I have to finish coding it until Friday... Some people still like this kind of websites (including myself). cheers. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com