HTML XML Use Case 04

From W3C Wiki
Jump to: navigation, search

This use case is about embedding islands of XML into HTML.

The basic answer from the HTML gang is that if you must do so, use a script element with a @type attribute that designates something that's not a script; the result is a block of plain text that can be parsed as XML with an appropriate JavaScript object (or as non-XML with some other JavaScript object, for that matter).

The XML gang replies: How can you be sure that a value designates "not a script"? They propose a @run or @norun attribute to explicitly allow or disallow browser execution of a given script object. The HTML gang says that wouldn't be useful for many years to come, and by that time people would have set a precedent of not bothering with either of them.

The HTML and some XML gang members think that unwanted execution isn't actually a problem, even though some browsers execute scripts other than application/javascript. (Specifically, IE executes application/jscript, and can be made to execute any Windows scripting language using a client-side API.) However, no browser is going to execute plain application/xml, and if a new non-JavaScript language becomes popular for browser-side execution, an entirely new media type can be chosen for it, like application/newscript.

Application/xquery scripts can already run in browsers given a JavaScript shim, which could disable itself if it were able to detect a browser capability of native XQuery application. That led to an explanation from the HTML gang about why "hasFeatureX" is a bad idea for feature detection: browsers tend to lie about having feature X, so you have to watch what they do, not what they say they do. So how do we know if a browser natively implements language X? We don't as of now. Hints of YAGNI.

Other XML gang members think it's tag abuse to use the script element for something that's not a script. The HTML gang counters that HTML element names are more about historical origin than current use: the i element is now "alternate presentation", not necessarily italics.

Other possibilities are adding specific bridge elements to incorporate new vocabularies, like the existing HTML svg and math elements.

Sorry for the lack of citations; I don't have the energy to pinpoint who said what where just now. Corrections are solicited.

--John Cowan 06:50, 24 January 2011 (UTC)

Additional comments in the [|Talk Section]