Parent Directory
|
Revision Log
|
Patch
| revision 1.13 by wakaba, Sun Apr 27 11:27:04 2008 UTC | revision 1.14 by wakaba, Tue Apr 29 02:50:00 2008 UTC | |
|---|---|---|
| # | Line 92 | Line 92 |
| 92 | Parser.prototype.getNextToken = function () { | Parser.prototype.getNextToken = function () { |
| 93 | var p = this; | var p = this; |
| 94 | var i = this.input; | var i = this.input; |
| 95 | if (this.parseMode == 'script') { | if (this.parseMode == 'cdata') { |
| 96 | var tagName = this.endTagName; | |
| 97 | var token; | var token; |
| 98 | if (p.insertionPoint <= 0) { | if (p.insertionPoint <= 0) { |
| 99 | return {type: 'abort'}; | return {type: 'abort'}; |
| # | Line 110 | Line 111 |
| 111 | return ''; | return ''; |
| 112 | }); | }); |
| 113 | if (token) return token; | if (token) return token; |
| 114 | i.s = i.s.replace (/^<\/[Ss][Cc][Rr][Ii][Pp][Tt]>/, function (s) { | var pattern = new RegExp ('^</' + tagName + '>', 'i'); |
| 115 | i.s = i.s.replace (pattern, function (s) { | |
| 116 | if (p.insertionPoint < s.length) { | if (p.insertionPoint < s.length) { |
| 117 | token = {type: 'abort'}; | token = {type: 'abort'}; |
| 118 | return s; | return s; |
| 119 | } | } |
| 120 | token = {type: 'end-tag', value: 'script'}; | token = {type: 'end-tag', value: tagName}; |
| 121 | p.insertionPoint -= s.length; | p.insertionPoint -= s.length; |
| 122 | return ''; | return ''; |
| 123 | }); | }); |
| 124 | if (token) return token; | if (token) return token; |
| 125 | var m; | var m; |
| 126 | if ((p.insertionPoint < '</script'.length) && | if ((p.insertionPoint < ('</' + tagName).length) && |
| 127 | (m = i.s.match (/^<\/([SCRIPTscript]+)/))) { | (m = i.s.match (/^<\/([A-Za-z]+)/))) { |
| 128 | var v = m[1].substring (0, p.insertionPoint).toLowerCase (); | var v = m[1].substring (0, p.insertionPoint).toLowerCase (); |
| 129 | if (v == 'script'.substring (0, p.insertionPoint - '</'.length)) { | if (v == tagName.substring (0, p.insertionPoint - '</'.length)) { |
| 130 | return {type: 'abort'}; | return {type: 'abort'}; |
| 131 | } | } |
| 132 | } | } |
| # | Line 229 | Line 231 |
| 231 | el.manakaiParserInserted = true; | el.manakaiParserInserted = true; |
| 232 | ||
| 233 | // 3. Switch the tokeniser's content model flag to the CDATA state. | // 3. Switch the tokeniser's content model flag to the CDATA state. |
| 234 | this.parseMode = 'script'; | this.parseMode = 'cdata'; |
| 235 | this.endTagName = 'script'; | |
| 236 | ||
| 237 | &n |