Commit e5623a49fd5d11b5b27c45f4172aa35484dded8c
- Diff rendering mode:
- inline
- side by side
statechartz/statechartz.js
(15 / 19)
|   | |||
| 744 | 744 | } | |
| 745 | 745 | } | |
| 746 | 746 | return resolveElement(scxmlElement); | |
| 747 | }, | ||
| 748 | loadFromDocument: function() { | ||
| 747 | }, | ||
| 748 | loadFromDocument: function() { | ||
| 749 | 749 | var links = document.getElementsByTagName("link"); | |
| 750 | 750 | for (var i=0; i < links.length;++i) { | |
| 751 | 751 | var link = links[i]; | |
| … | … | ||
| 753 | 753 | if (rel == "statechart") { | |
| 754 | 754 | var href = link.getAttribute("href"); | |
| 755 | 755 | var xhttp=new XMLHttpRequest(); | |
| 756 | xhttp.open("GET",href); | ||
| 757 | xhttp.onerror = function(e) { | ||
| 758 | }; | ||
| 756 | xhttp.open("GET",href,false); | ||
| 759 | 757 | xhttp.setRequestHeader("Content-Type","application/xml;charset=UTF8"); | |
| 760 | xhttp.onreadystatechange = function() { | ||
| 761 | if (this.readyState == 4) { | ||
| 762 | var xmlDoc=this.responseXML; | ||
| 763 | if (xmlDoc == null) { | ||
| 764 | var parser = new DOMParser(); | ||
| 765 | xmlDoc = parser.parseFromString(this.responseText,"text/xml"); | ||
| 766 | } | ||
| 767 | if (xmlDoc != null) { | ||
| 768 | document.statechart = Statechartz.loadScxml(xmlDoc); | ||
| 769 | document.statechart.start(); | ||
| 770 | } | ||
| 771 | } | ||
| 772 | }; | ||
| 773 | 758 | xhttp.send(""); | |
| 759 | if (xhttp.readyState == 4) { | ||
| 760 | var xmlDoc=xhttp.responseXML; | ||
| 761 | if (xmlDoc == null) { | ||
| 762 | var parser = new DOMParser(); | ||
| 763 | xmlDoc = parser.parseFromString(xhttp.responseText,"text/xml"); | ||
| 764 | } | ||
| 765 | if (xmlDoc != null) { | ||
| 766 | document.statechart = Statechartz.loadScxml(xmlDoc); | ||
| 767 | document.statechart.start(); | ||
| 768 | } | ||
| 769 | } | ||
| 774 | 770 | } | |
| 775 | 771 | } | |
| 776 | } | ||
| 772 | } | ||
| 777 | 773 | ||
| 778 | 774 | ||
| 779 | 775 | }; |

