X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions modules/@angular/core/test/linker/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,31 @@ function declareTests({useJit}: {useJit: boolean}) {
});
}));

it('should support foreignObjects with document fragments',
inject(
[TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: switch to tcb.overrideTemplate(html)

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', () => {
Expand Down
3 changes: 2 additions & 1 deletion modules/@angular/platform-browser/src/dom/dom_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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;
Expand Down
X Tutup