diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2009-11-08 13:42:27 -0800 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2009-11-08 13:42:27 -0800 |
commit | e5623a49fd5d11b5b27c45f4172aa35484dded8c (patch) | |
tree | 57f58e723d4eae06df0dec4ecfe8f2d0576deeb2 | |
parent | 540babfd98f09ec08974f1faecf9e705472544a9 (diff) |
back to sync parsing
-rw-r--r-- | statechartz/statechartz.js | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/statechartz/statechartz.js b/statechartz/statechartz.js index ed8bfb3..050cd37 100644 --- a/statechartz/statechartz.js +++ b/statechartz/statechartz.js @@ -744,8 +744,8 @@ Statechartz = } } return resolveElement(scxmlElement); - }, - loadFromDocument: function() { + }, + loadFromDocument: function() { var links = document.getElementsByTagName("link"); for (var i=0; i < links.length;++i) { var link = links[i]; @@ -753,27 +753,23 @@ Statechartz = if (rel == "statechart") { var href = link.getAttribute("href"); var xhttp=new XMLHttpRequest(); - xhttp.open("GET",href); - xhttp.onerror = function(e) { - }; + xhttp.open("GET",href,false); xhttp.setRequestHeader("Content-Type","application/xml;charset=UTF8"); - xhttp.onreadystatechange = function() { - if (this.readyState == 4) { - var xmlDoc=this.responseXML; - if (xmlDoc == null) { - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(this.responseText,"text/xml"); - } - if (xmlDoc != null) { - document.statechart = Statechartz.loadScxml(xmlDoc); - document.statechart.start(); - } - } - }; xhttp.send(""); + if (xhttp.readyState == 4) { + var xmlDoc=xhttp.responseXML; + if (xmlDoc == null) { + var parser = new DOMParser(); + xmlDoc = parser.parseFromString(xhttp.responseText,"text/xml"); + } + if (xmlDoc != null) { + document.statechart = Statechartz.loadScxml(xmlDoc); + document.statechart.start(); + } + } } } - } + } }; |