| 9106 | } |
| 9107 | |
| 9108 | function scanJSXEntity() { |
| 9109 | var ch, str = '', start = index, count = 0, code; |
| 9110 | ch = source[index]; |
| 9111 | assert(ch === '&', 'Entity must start with an ampersand'); |
| 9112 | index++; |
| 9113 | while (index < length && count++ < 10) { |
| 9114 | ch = source[index++]; |
| 9115 | if (ch === ';') { |
| 9116 | break; |
| 9117 | } |
| 9118 | str += ch; |
| 9119 | } |
| 9120 | |
| 9121 | // Well-formed entity (ending was found). |
| 9122 | if (ch === ';') { |
| 9123 | // Numeric entity. |
| 9124 | if (str[0] === '#') { |
| 9125 | if (str[1] === 'x') { |
| 9126 | code = +('0' + str.substr(1)); |
| 9127 | } else { |
| 9128 | // Removing leading zeros in order to avoid treating as octal in old browsers. |
| 9129 | code = +str.substr(1).replace(Regex.LeadingZeros, ''); |
| 9130 | } |
| 9131 | |
| 9132 | if (!isNaN(code)) { |
| 9133 | return String.fromCharCode(code); |
| 9134 | } |
| 9135 | /* istanbul ignore else */ |
| 9136 | } else if (XHTMLEntities[str]) { |
| 9137 | return XHTMLEntities[str]; |
| 9138 | } |
| 9139 | } |
| 9140 | |
| 9141 | // Treat non-entity sequences as regular text. |
| 9142 | index = start + 1; |
| 9143 | return '&'; |
| 9144 | } |
| 9145 | |
| 9146 | function scanJSXText(stopChars) { |
| 9147 | var ch, str = '', start; |