File tree Expand file tree Collapse file tree 4 files changed +42
-5
lines changed Expand file tree Collapse file tree 4 files changed +42
-5
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const { registerHTMLClass} = require ( '../shared/register-html-class.js' ) ;
3
3
const { escapeHtmlTextContent} = require ( '../shared/text-escaper.js' ) ;
4
- const { ignoreCase} = require ( '../shared/utils.js' ) ;
5
4
6
5
const { HTMLElement} = require ( './element.js' ) ;
7
6
@@ -16,7 +15,7 @@ class HTMLTitleElement extends HTMLElement {
16
15
}
17
16
18
17
get innerHTML ( ) { return super . innerHTML ; }
19
- set innerHTML ( html ) { super . innerHTML = ignoreCase ( this ) ? escapeHtmlTextContent ( html ) : html ; }
18
+ set innerHTML ( html ) { super . innerHTML = escapeHtmlTextContent ( html ) ; }
20
19
}
21
20
22
21
registerHTMLClass ( tagName , HTMLTitleElement ) ;
Original file line number Diff line number Diff line change 1
1
import { registerHTMLClass } from '../shared/register-html-class.js' ;
2
2
import { escapeHtmlTextContent } from '../shared/text-escaper.js' ;
3
- import { ignoreCase } from '../shared/utils.js' ;
4
3
5
4
import { HTMLElement } from './element.js' ;
6
5
@@ -15,7 +14,7 @@ class HTMLTitleElement extends HTMLElement {
15
14
}
16
15
17
16
get innerHTML ( ) { return super . innerHTML ; }
18
- set innerHTML ( html ) { super . innerHTML = ignoreCase ( this ) ? escapeHtmlTextContent ( html ) : html ; }
17
+ set innerHTML ( html ) { super . innerHTML = escapeHtmlTextContent ( html ) ; }
19
18
}
20
19
21
20
registerHTMLClass ( tagName , HTMLTitleElement ) ;
Original file line number Diff line number Diff line change
1
+ const assert = require ( '../assert.js' ) . for ( 'HTMLTitleElement' ) ;
2
+
3
+ const { DOMParser, parseHTML} = global [ Symbol . for ( 'linkedom' ) ] ;
4
+
5
+ const { document : htmlDoc } = parseHTML ( '<title>abc&<>"\t\n\r\xA0</title>' ) ;
6
+ assert (
7
+ htmlDoc . toString ( ) ,
8
+ '<title>abc&<>"\t\n\r </title>'
9
+ ) ;
10
+
11
+ const htmlTitle = htmlDoc . querySelector ( 'title' ) ;
12
+ htmlTitle . innerHTML = '<a>sub element</a>' ;
13
+ assert (
14
+ htmlTitle . innerHTML ,
15
+ '<a>sub element</a>'
16
+ ) ;
17
+ assert (
18
+ htmlDoc . toString ( ) ,
19
+ '<title><a>sub element</a></title>'
20
+ ) ;
21
+ assert ( htmlDoc . querySelectorAll ( 'a' ) . length , 0 ) ;
22
+
23
+ const xhtmlDoc = ( new DOMParser ) . parseFromString ( '<title xmlns="http://www.w3.org/1999/xhtml">abc&<>"\t\n\r\xA0</title>' , 'application/xhtml+xml' ) ;
24
+ assert (
25
+ xhtmlDoc . toString ( ) ,
26
+ '<?xml version="1.0" encoding="utf-8"?><title xmlns="http://www.w3.org/1999/xhtml">abc&<>"\t\n\r\xA0</title>'
27
+ ) ;
28
+
29
+ const xmlTitle = xhtmlDoc . querySelector ( 'title' ) ;
30
+ xmlTitle . innerHTML = '<a>sub element</a>' ;
31
+ assert (
32
+ xmlTitle . innerHTML ,
33
+ '<a>sub element</a>'
34
+ ) ;
35
+ assert (
36
+ xhtmlDoc . toString ( ) ,
37
+ '<?xml version="1.0" encoding="utf-8"?><title xmlns="http://www.w3.org/1999/xhtml"><a>sub element</a></title>'
38
+ ) ;
39
+ assert ( xhtmlDoc . querySelectorAll ( 'a' ) . length , 1 ) ;
Original file line number Diff line number Diff line change @@ -11411,7 +11411,7 @@ class HTMLTitleElement extends HTMLElement {
11411
11411
}
11412
11412
11413
11413
get innerHTML ( ) { return super . innerHTML ; }
11414
- set innerHTML ( html ) { super . innerHTML = ignoreCase ( this ) ? escapeHtmlTextContent ( html ) : html ; }
11414
+ set innerHTML ( html ) { super . innerHTML = escapeHtmlTextContent ( html ) ; }
11415
11415
}
11416
11416
11417
11417
registerHTMLClass ( tagName$9 , HTMLTitleElement ) ;
You can’t perform that action at this time.
0 commit comments