Revert "refactor(ivy): rename setNS, setHtmlNS and friends to namespace, namespaceHTML, etc (#23899)"

This reverts commit 0d06c866c6.
This commit is contained in:
Victor Berchet 2018-06-06 13:38:17 -07:00
parent 24ab0a7db0
commit c151f9cdc8
3 changed files with 16 additions and 32 deletions

View File

@ -556,38 +556,22 @@ function getRenderFlags(view: LView): RenderFlags {
//////////////////////////
//// Namespace
//////////////////////////
let _currentNamespace: string|null = null;
let _currentNS: string|null = null;
/**
* Sets the namespace URI that will be used to create elements in {@link element}
* and {@link elementStart}
* @param uri the full namespaceUri
*/
export function namespace(uri: string | null) {
_currentNamespace = uri;
export function setNS(namespace: string) {
_currentNS = namespace;
}
/**
* Sets the current namespace URI to null, meaning createElement (not createElementNS)
* will be used to create elements in {@link element} and {@link elementStart}
*/
export function namespaceHTML() {
_currentNamespace = null;
export function setHtmlNS() {
_currentNS = null;
}
/**
* Sets the current namespace URI to http://www.w3.org/2000/svg, which will be
* used in conjunction with createElementNS in {@link element} and {@link elementStart}
*/
export function namespaceSVG() {
_currentNamespace = 'http://www.w3.org/2000/svg';
export function setSvgNS() {
_currentNS = 'http://www.w3.org/2000/svg';
}
/**
* Sets the current namespace URI to http://www.w3.org/1998/Math/MathML, which will be
* used in conjunction with createElementNS in {@link element} and {@link elementStart}
*/
export function namespaceMathML() {
_currentNamespace = 'http://www.w3.org/1998/Math/MathML';
export function setMathML() {
_currentNS = 'http://www.w3.org/1998/Math/MathML';
}
@ -615,9 +599,9 @@ export function elementStart(
ngDevMode && ngDevMode.rendererCreateElement++;
const native: RElement = _currentNamespace === null || isProceduralRenderer(renderer) ?
const native: RElement = _currentNS === null || isProceduralRenderer(renderer) ?
renderer.createElement(name) :
(renderer as ObjectOrientedRenderer3).createElementNS(_currentNamespace, name);
(renderer as ObjectOrientedRenderer3).createElementNS(_currentNS, name);
ngDevMode && assertDataInRange(index - 1);

View File

@ -177,7 +177,7 @@
"name": "_currentInjector"
},
{
"name": "_currentNamespace"
"name": "_currentNS"
},
{
"name": "_devMode"

View File

@ -10,7 +10,7 @@ import {NgForOfContext} from '@angular/common';
import {RenderFlags, directiveInject} from '../../src/render3';
import {defineComponent} from '../../src/render3/definition';
import {bind, container, element, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, elementStyleNamed, interpolation1, namespaceHTML, namespaceSVG, renderTemplate, text, textBinding} from '../../src/render3/instructions';
import {bind, container, element, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, elementStyleNamed, interpolation1, renderTemplate, setHtmlNS, setSvgNS, text, textBinding} from '../../src/render3/instructions';
import {AttributeMarker, LElementNode, LNode} from '../../src/render3/interfaces/node';
import {RElement, domRendererFactory3} from '../../src/render3/interfaces/renderer';
import {TrustedString, bypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript, bypassSanitizationTrustStyle, bypassSanitizationTrustUrl, sanitizeHtml, sanitizeResourceUrl, sanitizeScript, sanitizeStyle, sanitizeUrl} from '../../src/sanitization/sanitization';
@ -433,7 +433,7 @@ describe('instructions', () => {
it('should render SVG', () => {
const t = new TemplateFixture(() => {
elementStart(0, 'div', ['id', 'container']);
namespaceSVG();
setSvgNS();
elementStart(1, 'svg', [
// id="display"
'id',
@ -452,7 +452,7 @@ describe('instructions', () => {
]);
element(2, 'circle', ['cx', '200', 'cy', '150', 'fill', '#0000ff']);
elementEnd();
namespaceHTML();
setHtmlNS();
elementEnd();
});