@@ -239,22 +239,24 @@ describe('HTML', function() {
239
239
} ) ;
240
240
241
241
it ( 'should accept SVG tags' , function ( ) {
242
- expectHTML ( '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"/></svg>' )
243
- . toEqual ( '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"/></svg>' ) ;
242
+ expectHTML ( '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"/></svg>' )
243
+ . toEqual ( '<svg width="400px" height="150px" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"/></svg>' ) ;
244
244
} ) ;
245
245
246
- it ( 'should sanitize SVG xmlns: xlink attribute values' , function ( ) {
247
- expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xmlns:xhref ="javascript:alert()"></a></svg>' )
248
- . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a></a></svg>' ) ;
246
+ it ( 'should sanitize SVG xlink:href attribute values' , function ( ) {
247
+ expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:href ="javascript:alert()"></a></svg>' )
248
+ . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a></a></svg>' ) ;
249
249
250
- expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xmlns:xhref="https://example.com"></a></svg>' )
251
- . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a></a></svg>' ) ;
250
+ expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:href="https://example.com"></a></svg>' )
251
+ . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:href="https://example.com"></a></svg>' ) ;
252
+ } ) ;
252
253
253
- expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:href="javascript:alert()"></a></svg>' )
254
- . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a></a></svg>' ) ;
254
+ it ( 'should sanitize unknown namespaced SVG attributes' , function ( ) {
255
+ expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:foo="javascript:alert()"></a></svg>' )
256
+ . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a></a></svg>' ) ;
255
257
256
- expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:href ="https://example.com"></a></svg>' )
257
- . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:href="https://example.com" ></a></svg>' ) ;
258
+ expectHTML ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a xlink:bar ="https://example.com"></a></svg>' )
259
+ . toEqual ( '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><a></a></svg>' ) ;
258
260
} ) ;
259
261
260
262
describe ( 'htmlSanitizerWriter' , function ( ) {
0 commit comments