feat(DomRenderer): Adding support for document fragments in SVG foreign objects (#9458)

This commit is contained in:
Gion Kunz 2016-06-27 17:26:45 +02:00 committed by Victor Berchet
parent fb2509675d
commit 3644eef860
2 changed files with 27 additions and 1 deletions

View File

@ -2000,6 +2000,31 @@ function declareTests({useJit}: {useJit: boolean}) {
});
}));
it('should support foreignObjects with document fragments',
inject(
[TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(
MyComp, new ViewMetadata({
template:
'<svg><foreignObject><xhtml:div><p>Test</p></xhtml:div></foreignObject></svg>'
}))
.createAsync(MyComp)
.then((fixture) => {
var el = fixture.debugElement.nativeElement;
var svg = getDOM().childNodes(el)[0];
var foreignObject = getDOM().childNodes(svg)[0];
var p = getDOM().childNodes(foreignObject)[0];
expect(getDOM().getProperty(<Element>svg, 'namespaceURI'))
.toEqual('http://www.w3.org/2000/svg');
expect(getDOM().getProperty(<Element>foreignObject, 'namespaceURI'))
.toEqual('http://www.w3.org/2000/svg');
expect(getDOM().getProperty(<Element>p, 'namespaceURI'))
.toEqual('http://www.w3.org/1999/xhtml');
async.done();
});
}));
});
describe('attributes', () => {

View File

@ -23,7 +23,8 @@ import {camelCaseToDashCase} from './util';
const NAMESPACE_URIS = {
'xlink': 'http://www.w3.org/1999/xlink',
'svg': 'http://www.w3.org/2000/svg'
'svg': 'http://www.w3.org/2000/svg',
'xhtml': 'http://www.w3.org/1999/xhtml'
};
const TEMPLATE_COMMENT_TEXT = 'template bindings={}';
var TEMPLATE_BINDINGS_EXP = /^template bindings=(.*)$/g;