From: Dion O. <dol...@us...> - 2006-01-24 22:25:17
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20314/magicajax/Core/script Modified Files: AjaxCallObject.js Log Message: Moved reflecting of added scripts and hidden fields to Page.PreRenderComplete and Page.UnLoad Index: AjaxCallObject.js =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** AjaxCallObject.js 24 Jan 2006 16:30:27 -0000 1.49 --- AjaxCallObject.js 24 Jan 2006 22:25:05 -0000 1.50 *************** *** 797,825 **** break; case "style": ! if (document.styleSheets) { // based on http://www.bobbyvandersluis.com/articles/dynamicCSS.php - var style = null; if (document.styleSheets.length == 0) ! style = this.CreateStyleTag(); //add style rule to last stylesheet (forces proper cascading) var lastStyle = document.styleSheets[document.styleSheets.length - 1]; ! if (typeof lastStyle.insertRule == "function") ! { ! //Mozilla ! var styleRule = document.createTextNode(innerText); ! style = (style == null) ? this.CreateStyleTag() : style; ! style.appendChild(styleRule); ! //lastStyle.insertRule(innerText, lastStyle.cssRules.length); //doesn't seems to work ! } ! else if (typeof lastStyle.addRule == "object") { - //IE var splitRules = innerText.split('}'); for (i=0; i<splitRules.length-1; i++) { ! var splitNameValue = splitRules[i].split('{'); ! lastStyle.addRule(splitNameValue[0], splitNameValue[1]); } } --- 797,832 ---- break; case "style": ! if (document.styleSheets && innerText != null) { // based on http://www.bobbyvandersluis.com/articles/dynamicCSS.php if (document.styleSheets.length == 0) ! { ! //no stylesheets yet, so create empty one ! var head = document.getElementsByTagName("head")[0]; ! var style = document.createElement("style"); ! style.type = "text/css"; ! head.appendChild(style); ! } //add style rule to last stylesheet (forces proper cascading) var lastStyle = document.styleSheets[document.styleSheets.length - 1]; ! var ieNewRule = typeof lastStyle.addRule == "object"; ! var ffNewRule = typeof lastStyle.insertRule == "function"; ! if (ieNewRule || ffNewRule) { var splitRules = innerText.split('}'); for (i=0; i<splitRules.length-1; i++) { ! if (ffNewRule) ! { ! //Mozilla ! lastStyle.insertRule(splitRules[i] + "}", lastStyle.cssRules.length); ! } ! else ! { ! //IE ! var splitNameValue = splitRules[i].split('{'); ! lastStyle.addRule(splitNameValue[0], splitNameValue[1]); ! } } } *************** *** 829,843 **** } - AjaxCallObject.prototype.CreateStyleTag = function() - { - var head = document.getElementsByTagName("head")[0]; - var style = (typeof document.createElementNS != "undefined") ? - document.createElementNS("http://www.w3.org/1999/xhtml", "style") : - document.createElement("style"); - style.setAttribute("type", "text/css"); - //style.setAttribute("media", "screen"); - return head.appendChild(style); - } - AjaxCallObject.prototype.SetFieldIfEmpty = function(fieldName, fieldValue) { --- 836,839 ---- |