Changeset 213

Show
Ignore:
Timestamp:
07/08/10 15:55:45 (2 months ago)
Author:
scott
Message:

Added support for XPath in IE.

Location:
xmvc/branches/remove-namespaces
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • xmvc/branches/remove-namespaces/example.js

    r205 r213  
    4444function Greeter () { 
    4545    this.hello = function (observer, ctx) { 
    46         var fragment = document.createElement("nothing") 
    47         observer.notify(fragment) 
     46        var newdoc = Sarissa.getDomDocument( 
     47                "http://example.com/", "nothing" 
     48                ) 
     49        observer.notify(newdoc) 
    4850    } 
    4951 
  • xmvc/branches/remove-namespaces/src/main/javascript/compat/javeline_xpath.js

    r201 r213  
    431431        } 
    432432} 
     433if(IS_IE){ 
     434        HTMLDocument.prototype.selectNodes =  
     435        HTMLElement.prototype.selectNodes = function(sExpr, contextNode){ 
     436                return XPath.selectNodes(sExpr, contextNode || this); 
     437        } 
     438        HTMLDocument.prototype.selectSingleNode =  
     439        HTMLElement.prototype.selectSingleNode = function(sExpr, contextNode){ 
     440                return XPath.selectNodes(sExpr, contextNode || this)[0]; // This could be optimized in the XPath object 
     441        } 
     442} 
  • xmvc/branches/remove-namespaces/src/main/javascript/xmvc/controller.js

    r212 r213  
    477477 
    478478            return matches.singleNodeValue 
     479        } 
     480        else if (document.selectSingleNode) { 
     481            return (context || controller.document).selectSingleNode( 
     482                    expression, resolver 
     483                    ) 
     484        } 
     485        else if (XPath.selectNodes) { 
     486            return XPath.selectNodes(expression, context)[0] 
    479487        } 
    480488    } 
     
    498506                results.push(matches.snapshotItem(i)) 
    499507            } 
     508        } 
     509        else if (document.selectNodes) { 
     510            results = (context || controller.document).selectNodes( 
     511                    expression, resolver 
     512                    ) 
     513        } 
     514        else if (XPath.selectNodes) { 
     515            results = XPath.selectNodes(expression, context) 
    500516        } 
    501517