GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — NativeScript/ui/builder/template-builder.ts at master · alvsgithub/NativeScript Expand file tree/ Copy pathtemplate-builder.tsMore file actions 57 lines (44 loc) · 1.87 KB / Copy pathtemplate-builder.tsFile metadata and controls57 lines (44 loc) · 1.87 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 import definition = require("ui/builder/template-builder"); var KNOWNTEMPLATES = "knownTemplates"; export class TemplateBuilder { private _items: Array<string>; private _templateProperty: definition.TemplateProperty; constructor(templateProperty: definition.TemplateProperty) { this._items = new Array<string>(); this._templateProperty = templateProperty; } public get elementName(): string { return this._templateProperty.elementName; } public addStartElement(prefix: string, namespace: string, elementName: string, attributes: Object) { this._items.push("<" + getElementNameWithPrefix(prefix, elementName) + (namespace ? " " + getNamespace(prefix, namespace) : "") + (attributes ? " " + getAttributesAsString(attributes) : "") + ">"); } public addEndElement(prefix: string, elementName: string) { this._items.push("</" + getElementNameWithPrefix(prefix, elementName) + ">"); } public build() { if (this._templateProperty.name in this._templateProperty.parent.component) { this._templateProperty.parent.component[this._templateProperty.name] = this._items.join(""); } } } export function isKnownTemplate(name: string, exports: any): boolean { return KNOWNTEMPLATES in exports && exports[KNOWNTEMPLATES] && name in exports[KNOWNTEMPLATES]; } function getAttributesAsString(attributes: Object): string { var result = []; for (var item in attributes) { result.push(item + '="' + attributes[item] + '"'); } return result.join(" "); } function getElementNameWithPrefix(prefix: string, elementName: string): string { return (prefix ? prefix + ":" : "") + elementName; } function getNamespace(prefix: string, namespace: string): string { return 'xmlns:' + prefix + '="' + namespace + '"'; } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |