You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/04/10 14:34:32 UTC
svn commit: r763918 -
/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
Author: werpu
Date: Fri Apr 10 12:34:32 2009
New Revision: 763918
URL: http://svn.apache.org/viewvc?rev=763918&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-2114
adding first works on the browser independed setAttribute function used
by the attributes response part
Modified:
myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
Modified: myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js?rev=763918&r1=763917&r2=763918&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js (original)
+++ myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js Fri Apr 10 12:34:32 2009
@@ -121,6 +121,76 @@
}
};
+
+myfaces._impl._util._Utils.ieQuircksEvents = {
+ "onabort": true,
+ "onload":true,
+ "onunload":true,
+ "onchange": true,
+ "onsubmit": true,
+ "onreset": true,
+ "onselect": true,
+ "onblur": true,
+ "onfocus": true,
+ "onkeydown": true,
+ "onkeypress": true,
+ "onkeyup": true,
+ "onclick": true,
+ "ondblclick": true,
+ "onmousedown": true,
+ "onmousemove": true,
+ "onmouseout": true,
+ "onmouseover": true,
+ "onmouseup": true
+};
+
+/**
+ * bugfixing for ie6 which does not cope properly with setAttribute
+ */
+myfaces._impl._util._Utils.setAttribute = function(domNode, attribute, value) {
+
+ if(!myfaces._impl._util._Utils.isUserAgentInternetExplorer()) {
+ domNode.setAttribute(attribute,value);
+ return;
+ }
+ //Now to the broken browsers IE6+.... ie7 and ie8 quirks mode
+
+
+ //now ie has the behavior of not wanting events to be set directly and also
+ //class must be renamed to classname
+ //according to http://www.quirksmode.org/dom/w3c_core.html it does not set styles
+ //also class == className we have to rechange that
+ //additionally events are not triggered as well
+
+ //what we do is following for now:
+ //1. remap the class
+ attribute = attribute.toLowerCase();
+
+ if(attribute === "class") {
+ domNode["className"] = value;
+ } else if(attribute === style) {
+ //We have to split the styles here and assign them one by one
+ var styleEntries = value.split(";");
+ for(var loop = 0; loop < styleEntries.length; loop++) {
+ var keyVal = styleEntries[loop].split(":");
+ domNode["style"][keyVal[0]] = keyVal[1];
+ }
+ } else {
+ //check if the attribute is an event, since this applies only
+ //to quirks mode of ie anyway we can live with the standard html4/xhtml
+ //ie supported events
+ if(myfaces._impl._util._Utils.ieQuircksEvents[attribute]) {
+ if(myfaces._impl._util._LangUtils.isString(attribute)) {
+ domNode[attribute] = function(event) {
+ eval(attribute);
+ };
+ }
+ }
+ domNode[attribute] = value;
+ }
+ //TODO this needs further testing I will leave it for now...
+};
+
/**
* [STATIC]
* Determines whether the user agent is IE or not