-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser support? #26
Comments
DOMly uses the following DOM methods and properties:
This was brought up before and we decided to expose DOMly's compiler so you can easily extend DOMly to support IE < 9 by overriding the var domly = require('domly');
// Extend DOMly's compiler
var Compiler = function() {
domly.Compiler.call(this);
};
Compiler.prototype = Object.create(domly.Compiler.prototype);
/**
Support: IE < 9
Use innerText instead of textContent if it's not available
*/
Compiler.prototype.setTextContent = function(elName, text) {
this.pushStatement(elName+'[typeof '+elName+'.textContent === "undefined" ? "innerText" : "textContent"] = '+this.makeVariableStatement(text)+';');
};
// Export a module that uses our new compiler
module.exports = {
Compiler: Compiler,
compile: function(html, options) {
var compiler = new Compiler(options);
return compiler.compile(html);
},
precompile: function(html, options) {
var compiler = new Compiler(options);
return compiler.precompile(html);
}
}; I'm not interested in adding support for IE < 9 to DOMly itself due to the performance hit and a general desire to push the web forward :). That said, it would be wise to add the above description to a wiki page or markdown file so it's clear to users what browsers are supported as well as how to override DOMly and integrate the overridden version when using |
From the description, it looks like DOMly's pre-compiled templates will work on IE8 and above (based on info about the use of
createElement
,DocumentFragment
andNode
). Is this assumption correct? Is there a browser support list?The text was updated successfully, but these errors were encountered: