* A bias in wfRandomString() toward digits 1-7 has been corrected. Generated
strings will now start with digits 0 and 8-f as often as they should.
* (bug 45371) Removed Parser_LinkHooks and CoreLinkFunctions classes.
+* (bug 41545) Allow <kbd>, <samp>, and <var> to be nested like allowed in html.
=== API changes in 1.22 ===
* (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
}
$htmlnest = array( # Tags that can be nested--??
'table', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul',
- 'li', 'dl', 'dt', 'dd', 'font', 'big', 'small', 'sub', 'sup', 'span'
+ 'li', 'dl', 'dt', 'dd', 'font', 'big', 'small', 'sub', 'sup', 'span',
+ 'var', 'kbd', 'samp'
);
$tabletags = array( # Can only appear inside table, we will close them
'td', 'th', 'tr',
);
}
- function testSelfClosingTag() {
- $this->setMwGlobals( array(
- 'wgUseTidy' => false
- ) );
-
- $this->assertEquals(
- '<div>Hello world</div>',
- Sanitizer::removeHTMLtags( '<div>Hello world</div />' ),
- 'Self-closing closing div'
+ function dataRemoveHTMLtags() {
+ return array(
+ // former testSelfClosingTag
+ array(
+ '<div>Hello world</div />',
+ '<div>Hello world</div>',
+ 'Self-closing closing div'
+ ),
+ // Make sure special nested HTML5 semantics are not broken
+ // http://www.whatwg.org/html/text-level-semantics.html#the-kbd-element
+ array(
+ '<kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd>',
+ '<kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd>',
+ 'Nested <kbd>.'
+ ),
+ // http://www.whatwg.org/html/text-level-semantics.html#the-sub-and-sup-elements
+ array(
+ '<var>x<sub><var>i</var></sub></var>, <var>y<sub><var>i</var></sub></var>',
+ '<var>x<sub><var>i</var></sub></var>, <var>y<sub><var>i</var></sub></var>',
+ 'Nested <var>.'
+ ),
+ // http://www.whatwg.org/html/text-level-semantics.html#the-dfn-element
+ array(
+ '<dfn><abbr title="Garage Door Opener">GDO</abbr></dfn>',
+ '<dfn><abbr title="Garage Door Opener">GDO</abbr></dfn>',
+ '<abbr> inside <dfn>',
+ ),
);
}
+ /**
+ * @dataProvider dataRemoveHTMLtags
+ */
+ function testRemoveHTMLtags( $input, $output, $msg = null ) {
+ $GLOBALS['wgUseTidy'] = false;
+ $this->assertEquals( $output, Sanitizer::removeHTMLtags( $input ), $msg );
+ }
/**
* @dataProvider provideTagAttributesToDecode