X Tutup
Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import {splitNsName} from 'angular2/src/compiler/html_tags';

import {ElementSchemaRegistry} from './element_schema_registry';

const NAMESPACE_URIS =
CONST_EXPR({'xlink': 'http://www.w3.org/1999/xlink', 'svg': 'http://www.w3.org/2000/svg'});
const NAMESPACE_URIS = CONST_EXPR({
'xlink': 'http://www.w3.org/1999/xlink',
'svg': 'http://www.w3.org/2000/svg',
'xhtml': 'http://www.w3.org/1999/xhtml'
});

@Injectable()
export class DomElementSchemaRegistry extends ElementSchemaRegistry {
Expand Down
7 changes: 5 additions & 2 deletions modules/angular2/src/platform/dom/dom_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ import {ViewEncapsulation} from 'angular2/src/core/metadata';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {camelCaseToDashCase} from './util';

const NAMESPACE_URIS =
CONST_EXPR({'xlink': 'http://www.w3.org/1999/xlink', 'svg': 'http://www.w3.org/2000/svg'});
const NAMESPACE_URIS = CONST_EXPR({
'xlink': 'http://www.w3.org/1999/xlink',
'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
24 changes: 24 additions & 0 deletions modules/angular2/test/core/linker/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,30 @@ export function main() {
});
}));

it('should support foreignObjects',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async) => {
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 = DOM.childNodes(el)[0];
var foreignObject = DOM.childNodes(svg)[0];
var p = DOM.childNodes(foreignObject)[0];
expect(DOM.getProperty(<Element>svg, 'namespaceURI'))
.toEqual('http://www.w3.org/2000/svg');
expect(DOM.getProperty(<Element>foreignObject, 'namespaceURI'))
.toEqual('http://www.w3.org/2000/svg');
expect(DOM.getProperty(<Element>p, 'namespaceURI'))
.toEqual('http://www.w3.org/1999/xhtml');

async.done();
});
}));
});
}
});
Expand Down
X Tutup