Author: maksimkaszynski
Date: 2008-03-27 12:38:57 -0400 (Thu, 27 Mar 2008)
New Revision: 7314
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingContext.java
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
http://jira.jboss.com/jira/browse/RF-1487
http://jira.jboss.com/jira/browse/RF-2737
http://jira.jboss.com/jira/browse/RF-2736
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-03-27
16:33:48 UTC (rev 7313)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-03-27
16:38:57 UTC (rev 7314)
@@ -99,6 +99,11 @@
} else if (state == stateManager.ENDELEMENT) {
if (context.getLastMatched() == stateManager.HTML) {
haveHtml = true;
+ //if xmlns is not set on HTML element, append xmlns attribute
+ if (!context.contains("xmlns=")) {
+ context.insert("
xmlns=\"http://www.w3.org/1999/xhtml\"");
+ }
+
context.send();
if (log.isDebugEnabled()) {
log.debug("Found <html> element");
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingContext.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingContext.java 2008-03-27
16:33:48 UTC (rev 7313)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingContext.java 2008-03-27
16:38:57 UTC (rev 7314)
@@ -149,7 +149,15 @@
this._lastMatched = state;
}
-
+
+ public boolean contains(String s) {
+ return buff.indexOf(s) >= 0;
+ }
+
+ public void insert(String s) {
+ buff.insert(buff.length() - 1, s);
+ }
+
/**
* @return Returns the _lastMatched.
*/
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-03-27 16:33:48 UTC
(rev 7313)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-03-27 16:38:57 UTC
(rev 7314)
@@ -255,18 +255,21 @@
// first attempt - .getElementById.
var oDoc = this._request.responseXML;
if(oDoc){
- if(typeof(oDoc.evaluate) != 'undefined') {
- // Xpath is prefer to use, so it work in the Firefox without XHTML xml namespace
in the result.
- LOG.debug("call XMLDocument.evaluate for id= "+id);
- return
oDoc.evaluate("//*[(a)id='"+id+"']",oDoc,null,9,null).singleNodeValue;//
9 - XPathResult.FIRST_ORDERED_NODE_TYPE
- } else if(typeof(oDoc.getElementById) != 'undefined') {
+ if(typeof(oDoc.getElementById) != 'undefined') {
LOG.debug("call getElementById for id= "+id);
- var element = oDoc.getElementById(id);
- } else if(typeof(oDoc.selectSingleNode) != "undefined") {
+ return oDoc.getElementById(id);
+ }
+ else if(typeof(oDoc.selectSingleNode) != "undefined") {
LOG.debug("call selectSingleNode for id= "+id);
return oDoc.selectSingleNode("//*[@id='"+id+"']"); /*
XPATH istead of ID */
- }
- LOG.error("No functions for getElementById found ");
+ }
+ // nodeFromID not worked since XML validation disabled by
+ // default for MS
+ else if(typeof(oDoc.nodeFromID) != "undefined") {
+ LOG.debug("call nodeFromID for id= "+id);
+ return oDoc.nodeFromID(id);
+ }
+ LOG.error("No functions for getElementById found ");
} else {
LOG.debug("No parsed XML document in response");
}