@@ -89,4 +89,64 @@ public function testDenyAttribute() {
8989 '<div onload="alert( \'XSS \')" onclick="die()">...</div> '
9090 );
9191 }
92+
93+ /**
94+ * Allow lists to be nested by default.
95+ */
96+ public function testDirectNestList () {
97+ $ html = <<<HTML
98+ <ul>
99+ <li>one</li>
100+ <ol>
101+ <li>two</li>
102+ </ol>
103+ </ul>
104+ HTML ;
105+ $ this ->assertFiltered ($ html , $ html );
106+ }
107+
108+ /**
109+ * Provide the elements for {@link testElements()}.
110+ *
111+ * @return array Returns an array for testing.
112+ */
113+ public function provideInvalidElements () {
114+ $ elements = explode ('- ' , 'applet-button-form-input-textarea-iframe-script-style-embed-object ' );
115+ $ result = [];
116+ foreach ($ elements as $ element ) {
117+ $ result [$ element ] = [$ element ];
118+ }
119+ return $ result ;
120+ }
121+
122+ /**
123+ * Test that default invalid elements are removed.
124+ *
125+ * @param string $element The element that should be removed.
126+ * @dataProvider provideInvalidElements
127+ */
128+ public function testInvalidElements ($ element ) {
129+ $ html = "<div>< $ element>hi</ $ element></div> " ;
130+ $ this ->assertFiltered ('<div>hi</div> ' , $ html );
131+ }
132+
133+ /**
134+ * Test to make sure `javascript:` isn't allowed in an href.
135+ */
136+ public function testBadScheme () {
137+ $ this ->assertFiltered (
138+ '<a rel="nofollow" href="denied:javascript:alert( \'xss \')">click</a> ' ,
139+ '<a href="javascript:alert( \'xss \')">click</a> '
140+ );
141+ }
142+
143+ /**
144+ * Make sure duplicate ID checks aren't being done.
145+ */
146+ public function testAllowDuplicateIDs () {
147+ $ this ->assertFiltered (
148+ '<b id="x">one</b><i id="x">two</i> ' ,
149+ '<b id="x">one</b><i id="x">two</i> '
150+ );
151+ }
92152}
0 commit comments