@breakside/jskit 2024.22.0 → 2024.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSAttributedString.js +32 -0
- package/Frameworks/Foundation.jsframework/JS/JSHTMLTextParser.js +584 -0
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/sources.json +3 -0
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Node/jskit +1 -0
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSAttributedString.js +32 -0
- package/Root/Frameworks/Foundation/JSHTMLTextParser.js +584 -0
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/JSColor+UIKit.js +14 -9
- package/Root/Frameworks/UIKit/UINavigationBar.js +7 -0
- package/Root/Frameworks/UIKit/UIPopupButton.js +18 -0
- package/Root/Frameworks/UIKit/UIWindow.js +4 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
// #import "JSObject.js"
|
|
2
|
+
// #import "JSProtocol.js"
|
|
3
|
+
// #import "JSFont.js"
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
JSProtocol("JSHTMLTextParserDelegate", JSProtocol, {
|
|
7
|
+
|
|
8
|
+
htmlTextParserDidFindAttributedText: function(parser, text, attributes){
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
(function(){
|
|
14
|
+
|
|
15
|
+
JSClass("JSHTMLTextParser", JSObject, {
|
|
16
|
+
|
|
17
|
+
html: null,
|
|
18
|
+
offset: null,
|
|
19
|
+
length: null,
|
|
20
|
+
delegate: null,
|
|
21
|
+
|
|
22
|
+
initWithHTML: function(html){
|
|
23
|
+
this.html = html;
|
|
24
|
+
this.offset = 0;
|
|
25
|
+
this.length = this.html.length;
|
|
26
|
+
this.state = Object.create(JSHTMLTextParser.State);
|
|
27
|
+
this.state.textAttributes = {};
|
|
28
|
+
this.stack = [this.state];
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
parse: function(){
|
|
32
|
+
var html = this.html;
|
|
33
|
+
var i = this.offset;
|
|
34
|
+
var l = this.length;
|
|
35
|
+
if (html === null || html === undefined){
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var elementName;
|
|
39
|
+
var entityName;
|
|
40
|
+
var attrName;
|
|
41
|
+
var attrValue;
|
|
42
|
+
var quote;
|
|
43
|
+
var elementAttributes;
|
|
44
|
+
var selfClosing = false;
|
|
45
|
+
while (i < l){
|
|
46
|
+
if (this.state.ignoringUntilEndTag){
|
|
47
|
+
if (html[i] === "<"){
|
|
48
|
+
++i;
|
|
49
|
+
if (i < l && html[i] === "/"){
|
|
50
|
+
++i;
|
|
51
|
+
if (html.substr(i, this.state.elementName.length).toLowerCase() === this.state.elementName){
|
|
52
|
+
i += this.state.elementName.length;
|
|
53
|
+
if (i < l && html[i] === ">"){
|
|
54
|
+
++i;
|
|
55
|
+
this.popState();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}else{
|
|
60
|
+
++i;
|
|
61
|
+
}
|
|
62
|
+
}else if (html[i] === "<"){
|
|
63
|
+
++i;
|
|
64
|
+
if (i < l){
|
|
65
|
+
if (isAlphabetic(html[i])){
|
|
66
|
+
elementName = "";
|
|
67
|
+
while (i < l && html[i] !== "/" && html[i] !== ">" && !isWhitespace(html[i])){
|
|
68
|
+
if ((html[i] >= "A" && html[i] <= "Z")){
|
|
69
|
+
elementName += html[i].toLowerCase();
|
|
70
|
+
}else{
|
|
71
|
+
elementName += html[i];
|
|
72
|
+
}
|
|
73
|
+
++i;
|
|
74
|
+
}
|
|
75
|
+
elementAttributes = {};
|
|
76
|
+
selfClosing = isVoidElement(elementName);
|
|
77
|
+
if (i < l && html[i] === "/"){
|
|
78
|
+
++i;
|
|
79
|
+
}
|
|
80
|
+
while (i < l && html[i] !== ">"){
|
|
81
|
+
while (i < l && isWhitespace(html[i])){
|
|
82
|
+
++i;
|
|
83
|
+
}
|
|
84
|
+
attrName = "";
|
|
85
|
+
attrValue = "";
|
|
86
|
+
while (i < l && html[i] !== "=" && html[i] !== "/" && html[i] !== ">" && !isWhitespace(html[i])){
|
|
87
|
+
attrName += html[i];
|
|
88
|
+
++i;
|
|
89
|
+
}
|
|
90
|
+
while (i < l && isWhitespace(html[i])){
|
|
91
|
+
++i;
|
|
92
|
+
}
|
|
93
|
+
if (i < l && html[i] === "="){
|
|
94
|
+
++i;
|
|
95
|
+
if (i < l && html[i] !== ">"){
|
|
96
|
+
if (html[i] === "\"" || html[i] === "'"){
|
|
97
|
+
quote = html[i];
|
|
98
|
+
++i;
|
|
99
|
+
while (i < l && html[i] !== quote){
|
|
100
|
+
if (html[i] === "&"){
|
|
101
|
+
entityName = "";
|
|
102
|
+
while (i < l && (isEntityCharacter(html[i]))){
|
|
103
|
+
entityName += html[i];
|
|
104
|
+
++i;
|
|
105
|
+
}
|
|
106
|
+
if (i < l && html[i] === ";"){
|
|
107
|
+
++i;
|
|
108
|
+
attrValue += decodedEntity(entityName);
|
|
109
|
+
}else{
|
|
110
|
+
attrValue += "&" + entityName;
|
|
111
|
+
}
|
|
112
|
+
}else{
|
|
113
|
+
attrValue += html[i];
|
|
114
|
+
++i;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
++i;
|
|
118
|
+
}else{
|
|
119
|
+
while (i < l && html[i] !== "/" && html[i] !== ">" && !isWhitespace(html[i])){
|
|
120
|
+
attrValue += html[i];
|
|
121
|
+
++i;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (i < l && html[i] === "/"){
|
|
127
|
+
++i;
|
|
128
|
+
}
|
|
129
|
+
elementAttributes[attrName] = attrValue;
|
|
130
|
+
}
|
|
131
|
+
++i;
|
|
132
|
+
this.beginElement(elementName, elementAttributes, selfClosing);
|
|
133
|
+
}else if (html[i] === "/"){
|
|
134
|
+
++i;
|
|
135
|
+
elementName = "";
|
|
136
|
+
if (isAlphabetic(html[i])){
|
|
137
|
+
while (i < l && html[i] !== "/" && html[i] !== ">" && !isWhitespace(html[i])){
|
|
138
|
+
if ((html[i] >= "A" && html[i] <= "Z")){
|
|
139
|
+
elementName += html[i].toLowerCase();
|
|
140
|
+
}else{
|
|
141
|
+
elementName += html[i];
|
|
142
|
+
}
|
|
143
|
+
++i;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
while (i < l && html[i] !== ">"){
|
|
147
|
+
++i;
|
|
148
|
+
}
|
|
149
|
+
++i;
|
|
150
|
+
this.endElement(elementName);
|
|
151
|
+
}else if (html[i] === "!" || html[i] === "?"){
|
|
152
|
+
// valid comments or bogus markup...skipping
|
|
153
|
+
// <!--
|
|
154
|
+
// <!DOCTYPE
|
|
155
|
+
// <![CDATA[
|
|
156
|
+
// <?xml
|
|
157
|
+
++i;
|
|
158
|
+
while (i < l && html[i] !== ">"){
|
|
159
|
+
++i;
|
|
160
|
+
}
|
|
161
|
+
++i;
|
|
162
|
+
}else{
|
|
163
|
+
this.handleText("<");
|
|
164
|
+
}
|
|
165
|
+
}else{
|
|
166
|
+
this.handleText("<");
|
|
167
|
+
}
|
|
168
|
+
}else if (html[i] === "&"){
|
|
169
|
+
++i;
|
|
170
|
+
entityName = "";
|
|
171
|
+
while (i < l && (isEntityCharacter(html[i]))){
|
|
172
|
+
entityName += html[i];
|
|
173
|
+
++i;
|
|
174
|
+
}
|
|
175
|
+
if (i < l && html[i] === ";"){
|
|
176
|
+
++i;
|
|
177
|
+
this.handleText(decodedEntity(entityName));
|
|
178
|
+
}else{
|
|
179
|
+
this.handleText("&" + entityName);
|
|
180
|
+
}
|
|
181
|
+
}else{
|
|
182
|
+
if (this.state.preserveWhitespace){
|
|
183
|
+
this.handleText(html[i]);
|
|
184
|
+
}else{
|
|
185
|
+
if (isWhitespace(html[i])){
|
|
186
|
+
if (this.trailingWhitespace === ""){
|
|
187
|
+
this.handleTrailingWhitespace(html[i]);
|
|
188
|
+
}
|
|
189
|
+
}else{
|
|
190
|
+
this.handleText(html[i]);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
++i;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
this.flush();
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
beginElement: function(elementName, elementAttributes, selfClosing){
|
|
200
|
+
if (isBlockElement(elementName)){
|
|
201
|
+
this.flushTrailingWhitespace();
|
|
202
|
+
if (this.recentText !== "" && !this.recentText.endsWith("\n") && !this.recentText.endsWith("\t")){
|
|
203
|
+
this.handleText("\n");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (!selfClosing){
|
|
207
|
+
this.pushState(elementName, elementAttributes);
|
|
208
|
+
|
|
209
|
+
if (elementName === "ol"){
|
|
210
|
+
this.state.counter = {count: 1};
|
|
211
|
+
}else{
|
|
212
|
+
this.state.counter = null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (elementName === "script" || elementName === "style" || elementName === "template"){
|
|
216
|
+
this.state.ignoringUntilEndTag = true;
|
|
217
|
+
}else if (elementName === "h1"){
|
|
218
|
+
this.state.textAttributes.paragraphStyleName = "heading1";
|
|
219
|
+
}else if (elementName === "h2"){
|
|
220
|
+
this.state.textAttributes.paragraphStyleName = "heading2";
|
|
221
|
+
}else if (elementName === "h3"){
|
|
222
|
+
this.state.textAttributes.paragraphStyleName = "heading3";
|
|
223
|
+
}else if (elementName === "h4"){
|
|
224
|
+
this.state.textAttributes.paragraphStyleName = "heading4";
|
|
225
|
+
}else if (elementName === "h5"){
|
|
226
|
+
this.state.textAttributes.paragraphStyleName = "heading5";
|
|
227
|
+
}else if (elementName === "h6"){
|
|
228
|
+
this.state.textAttributes.paragraphStyleName = "heading6";
|
|
229
|
+
}else if (elementName === "b" || elementName === "strong"){
|
|
230
|
+
this.state.textAttributes.bold = true;
|
|
231
|
+
}else if (elementName === "i" || elementName === "em"){
|
|
232
|
+
this.state.textAttributes.italic = true;
|
|
233
|
+
}else if (elementName === "u"){
|
|
234
|
+
this.state.textAttributes.underline = true;
|
|
235
|
+
}else if (elementName === "s"){
|
|
236
|
+
this.state.textAttributes.strike = true;
|
|
237
|
+
}else if (elementName === "a"){
|
|
238
|
+
if (elementAttributes.href){
|
|
239
|
+
this.state.textAttributes.link = JSURL.initWithString(elementAttributes.href, this.state.baseURL);
|
|
240
|
+
}
|
|
241
|
+
}else if (elementName === "li"){
|
|
242
|
+
var level = 0;
|
|
243
|
+
var stackIndex;
|
|
244
|
+
for (stackIndex = this.stack.length - 1; stackIndex >= 0; --stackIndex){
|
|
245
|
+
if (this.stack[stackIndex].elementName === "ol" || this.stack[stackIndex].elementName === "ul"){
|
|
246
|
+
++level;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (level === 0){
|
|
250
|
+
level = 1;
|
|
251
|
+
}
|
|
252
|
+
this.state.textAttributes.headIndent = 10 * level;
|
|
253
|
+
}else if (elementName === "pre"){
|
|
254
|
+
this.state.preserveWhitespace = true;
|
|
255
|
+
}
|
|
256
|
+
if (elementAttributes.style){
|
|
257
|
+
// TODO: CSS styles from element's style attr
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (elementName === "li"){
|
|
261
|
+
var parentState = this.stack[this.stack.length - 2];
|
|
262
|
+
if (parentState.counter !== null){
|
|
263
|
+
this.handleText("%d. ".sprintf(parentState.counter.count));
|
|
264
|
+
++parentState.counter.count;
|
|
265
|
+
}else{
|
|
266
|
+
this.handleText("• ");
|
|
267
|
+
}
|
|
268
|
+
}else if (elementName === "br"){
|
|
269
|
+
this.flushTrailingWhitespace();
|
|
270
|
+
this.handleTrailingWhitespace("\n");
|
|
271
|
+
}else if (elementName === "hr"){
|
|
272
|
+
this.handleText("----------");
|
|
273
|
+
this.handleTrailingWhitespace("\n");
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
endElement: function(elementName){
|
|
278
|
+
elementName = elementName.toLowerCase();
|
|
279
|
+
if (this.stack[this.stack.length - 1].elementName === elementName){
|
|
280
|
+
if (elementName === "p"){
|
|
281
|
+
this.handleTrailingWhitespace("\n");
|
|
282
|
+
}else if (elementName === "div"){
|
|
283
|
+
this.handleTrailingWhitespace("\n");
|
|
284
|
+
}else if (elementName === "li"){
|
|
285
|
+
this.handleTrailingWhitespace("\n");
|
|
286
|
+
}else if (elementName === "th" || elementName === "td"){
|
|
287
|
+
this.handleTrailingWhitespace("\t");
|
|
288
|
+
}else if (elementName === "tr"){
|
|
289
|
+
this.handleTrailingWhitespace("\n");
|
|
290
|
+
}
|
|
291
|
+
this.popState();
|
|
292
|
+
}else{
|
|
293
|
+
// ingore mismatched end tag
|
|
294
|
+
// spec calls for more complicated behavior, but
|
|
295
|
+
// trying to keep things simple for now.
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
pushState: function(elementName, elementAttributes){
|
|
300
|
+
this.flush();
|
|
301
|
+
var state = Object.create(this.state);
|
|
302
|
+
state.textAttributes = JSCopy(state.textAttributes);
|
|
303
|
+
state.elementName = elementName;
|
|
304
|
+
state.elementAttributes = elementAttributes;
|
|
305
|
+
this.stack.push(state);
|
|
306
|
+
this.state = state;
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
popState: function(){
|
|
310
|
+
this.flush();
|
|
311
|
+
if (this.stack.length > 1){
|
|
312
|
+
this.stack.pop();
|
|
313
|
+
this.state = this.stack[this.stack.length - 1];
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
textBuffer: "",
|
|
318
|
+
textBufferAttributes: null,
|
|
319
|
+
recentText: "",
|
|
320
|
+
trailingWhitespace: "",
|
|
321
|
+
|
|
322
|
+
handleTrailingWhitespace: function(text){
|
|
323
|
+
this.recentText = text;
|
|
324
|
+
this.trailingWhitespace = text;
|
|
325
|
+
this.textBufferAttributes = this.state.textAttributes;
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
handleText: function(text){
|
|
329
|
+
this.flushTrailingWhitespace();
|
|
330
|
+
this.recentText = text;
|
|
331
|
+
this.textBuffer += text;
|
|
332
|
+
this.textBufferAttributes = this.state.textAttributes;
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
flushTrailingWhitespace: function(){
|
|
336
|
+
if (this.trailingWhitespace !== ""){
|
|
337
|
+
this.textBuffer += this.trailingWhitespace;
|
|
338
|
+
this.trailingWhitespace = "";
|
|
339
|
+
this.flush();
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
flush: function(){
|
|
344
|
+
if (this.textBuffer.length > 0){
|
|
345
|
+
if (this.delegate && this.delegate.htmlTextParserDidFindAttributedText){
|
|
346
|
+
this.delegate.htmlTextParserDidFindAttributedText(this, this.textBuffer, this.textBufferAttributes);
|
|
347
|
+
}
|
|
348
|
+
this.textBuffer = "";
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
JSHTMLTextParser.State = {
|
|
355
|
+
// html elements
|
|
356
|
+
elementName: null,
|
|
357
|
+
elementAttributes: null,
|
|
358
|
+
counter: null,
|
|
359
|
+
baseURL: null,
|
|
360
|
+
|
|
361
|
+
// options
|
|
362
|
+
preserveWhitespace: false,
|
|
363
|
+
ignoringUntilEndTag: false,
|
|
364
|
+
|
|
365
|
+
// text attributes
|
|
366
|
+
textAttributes: null,
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
var isWhitespace = function(c){
|
|
370
|
+
return c === " " || c === "\t" || c === "\n" || c === "\x0c";
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
var isEntityCharacter = function(c){
|
|
374
|
+
return isAlphabetic(c) || isNumeric(c);
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
var isAlphabetic = function(c){
|
|
378
|
+
if (c >= "a" && c <= "z"){
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
if (c >= "A" && c <= "Z"){
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
return false;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
var isNumeric = function(c){
|
|
388
|
+
if (c >= "0" && c <= "9"){
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
var isVoidElement = function(name){
|
|
395
|
+
if (name === "area"){
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
if (name === "base"){
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
if (name === "br"){
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
if (name === "col"){
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
if (name === "embed"){
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
if (name === "hr"){
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
if (name === "img"){
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
if (name === "input"){
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
if (name === "link"){
|
|
420
|
+
return true;
|
|
421
|
+
}
|
|
422
|
+
if (name === "meta"){
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
if (name === "source"){
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
if (name === "track"){
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
if (name === "wbr"){
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
return false;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
var isBlockElement = function(name){
|
|
438
|
+
if (name === "a"){
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
if (name === "em"){
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
if (name === "strong"){
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
if (name === "small"){
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
if (name === "s"){
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
if (name === "cite"){
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
if (name === "q"){
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
if (name === "dfn"){
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
if (name === "abbr"){
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
if (name === "ruby"){
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
if (name === "rt"){
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
if (name === "rp"){
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
if (name === "data"){
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
if (name === "time"){
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
if (name === "code"){
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
if (name === "var"){
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
if (name === "samp"){
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
if (name === "kbd"){
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
if (name === "sub"){
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
if (name === "sup"){
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
if (name === "i"){
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
if (name === "b"){
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
if (name === "u"){
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
if (name === "mark"){
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
if (name === "bdi"){
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
if (name === "bdo"){
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
if (name === "span"){
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
if (name === "br"){
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
if (name === "wbr"){
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
if (name === "picture"){
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
if (name === "source"){
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
if (name === "img"){
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
if (name === "label"){
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
if (name === "script"){
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
if (name === "template"){
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
if (name === "style"){
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
if (name === "base"){
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
return true;
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
var decodedEntity = function(name){
|
|
553
|
+
name = name.toLowerCase();
|
|
554
|
+
var value;
|
|
555
|
+
if (name.length > 0 && name[0] == "#"){
|
|
556
|
+
if (name.length > 1 && name[1] === "x"){
|
|
557
|
+
value = parseInt(name.substr(2), 16);
|
|
558
|
+
}else{
|
|
559
|
+
value = parseInt(name.substr(1));
|
|
560
|
+
}
|
|
561
|
+
if (!isNaN(value)){
|
|
562
|
+
return String.fromCharCode(value);
|
|
563
|
+
}
|
|
564
|
+
}else{
|
|
565
|
+
if (name === "lt"){
|
|
566
|
+
return "<";
|
|
567
|
+
}
|
|
568
|
+
if (name === "gt"){
|
|
569
|
+
return ">";
|
|
570
|
+
}
|
|
571
|
+
if (name === "amp"){
|
|
572
|
+
return "&";
|
|
573
|
+
}
|
|
574
|
+
if (name === "quot"){
|
|
575
|
+
return "\"";
|
|
576
|
+
}
|
|
577
|
+
if (name === "nbsp"){
|
|
578
|
+
return "\u00a0";
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return "&" + name + ";";
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
})();
|