- From: Brett Zamir <brettz9@yahoo.com>
- Date: Mon, 18 May 2009 20:45:18 +0800
One more thought... While it is great that innerHTML is being officially standardized, I'm afraid it would be rather hackish to have to use it for parsing and serializing dynamically created content which wasn't destined to make it immediately into the document, if at all. Has any thought been given to standardizing on at least a part of DOM Level 3 Load and Save in HTML5? The API, if simply applied to serialization, would look like this : var ser = DOMImplementationLS.createLSSerializer(); var str = ser.writeToString(document); and like this for parsing to the DOM: var lsParser = DOMImplementationLS.createLSParser(1, null); // 1 for synchronous; null for no schema type var lsInput = DOMImplementationLS.createLSInput(); lsInput.stringData = '<myXml/>'; var doc = lsParser.parse(lsInput); If a revision to the DOM3 module is not in order (which, e.g., simplifies the parsing from a string for simple cases) and the above is considered too cumbersome, maybe some other cross-browser standard could be agreed upon? I think using DOM3 would facilitate readily adding additional aspects of the module in the future (as ECMAScript seems to be positively albeit slowly expanding to ever new uses) and offer familiarity for those working in other contexts with DOM Level 3, while ECMAScript users can still wrap these in their own simpler functions. However, I can also see the desire for something simpler (as I say, maybe an addendum to the L&S module). But I do hope something might be considered, since I find this to be a quite frequent need and do not like relying on feature-checking for non-standard methods in the various browsers as well as being unclear on how to future-proof my code to work with standards-compliant browsers... thanks, Brett
Received on Monday, 18 May 2009 05:45:18 UTC