fix(DomRegistry): fix svg support

This commit is contained in:
Victor Berchet
2016-05-26 16:17:35 -07:00
parent 0b6967fd74
commit 307d105d2c
3 changed files with 89 additions and 82 deletions

View File

@ -10,6 +10,9 @@ import {
xit
} from '@angular/core/testing/testing_internal';
import {HtmlParser} from '@angular/compiler/src/html_parser';
import {HtmlElementAst} from '@angular/compiler/src/html_ast';
import {browserDetection} from '@angular/platform-browser/testing';
import {DomElementSchemaRegistry} from '@angular/compiler/src/schema/dom_element_schema_registry';
@ -68,8 +71,11 @@ export function main() {
expect(registry.securityContext('base', 'href')).toBe(SecurityContext.RESOURCE_URL);
});
it('should detect properties on namespaced elements',
() => { expect(registry.hasProperty('@svg:g', 'id')).toBeTruthy(); });
it('should detect properties on namespaced elements', () => {
let htmlAst = new HtmlParser().parse('<svg:style>', 'TestComp');
let nodeName = (<HtmlElementAst>htmlAst.rootNodes[0]).name;
expect(registry.hasProperty(nodeName, 'type')).toBeTruthy();
});
if (browserDetection.isChromeDesktop) {
it('generate a new schema', () => {

View File

@ -1,6 +1,6 @@
import {isString, isPresent} from '../../src/facade/lang';
const SVG_PREFIX = '@svg:';
const SVG_PREFIX = ':svg:';
var document = typeof global['document'] == 'object' ? global['document'] : null;