-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ jspm_packages | |
.idea | ||
.DS_STORE | ||
build/reports | ||
dist/ | ||
spec/*.js | ||
spec/*.map |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/** | ||
* Represents the core APIs of the DOM. | ||
*/ | ||
export interface IDom { | ||
/** | ||
* The global DOM Element type. | ||
*/ | ||
Element: typeof Element; | ||
/** | ||
* The global DOM SVGElement type. | ||
*/ | ||
SVGElement: typeof SVGElement; | ||
/** | ||
* A key representing a DOM boundary. | ||
*/ | ||
boundary: string; | ||
/** | ||
* The document title. | ||
*/ | ||
title: string; | ||
/** | ||
* The document's active/focused element. | ||
*/ | ||
activeElement: Element; | ||
/** | ||
* Add an event listener to the document. | ||
* @param eventName A string representing the event type to listen for. | ||
* @param callback The function that receives a notification when an event of the specified type occurs. | ||
* @param capture If true, useCapture indicates that the user wishes to initiate capture. | ||
*/ | ||
addEventListener(eventName: string, callback: EventListener, capture: boolean): void; | ||
/** | ||
* Remove an event listener from the document. | ||
* @param eventName A string representing the event type to listen for. | ||
* @param callback The function to remove from the event. | ||
* @param capture Specifies whether the listener to be removed was registered as a capturing listener or not. | ||
*/ | ||
removeEventListener(eventName: string, callback: EventListener, capture: boolean): void; | ||
/** | ||
* Adopts a node from an external document. | ||
* @param node The node to be adopted. | ||
* @return The adopted node able to be used in the document. | ||
*/ | ||
adoptNode(node: Node): Node; | ||
/** | ||
* Creates the specified HTML element or an HTMLUnknownElement if the given element name isn't a known one. | ||
* @param tagName A string that specifies the type of element to be created. | ||
* @return The created element. | ||
*/ | ||
createElement(tagName: string): Element; | ||
/** | ||
* Creates a new Text node. | ||
* @param text A string to populate the new Text node. | ||
* @return A Text node. | ||
*/ | ||
createTextNode(text: string): Text; | ||
/** | ||
* Creates a new Comment node. | ||
* @param text A string to populate the new Comment node. | ||
* @return A Comment node. | ||
*/ | ||
createComment(text: string): Comment; | ||
/** | ||
* Creates a new DocumentFragment. | ||
* @return A DocumentFragment. | ||
*/ | ||
createDocumentFragment(): DocumentFragment; | ||
/** | ||
* Creates a new MutationObserver. | ||
* @param callback A callback that will recieve the change records with the mutations. | ||
* @return A MutationObservere. | ||
*/ | ||
createMutationObserver(callback: (changes: MutationRecord[], instance: MutationObserver) => void): MutationObserver; | ||
/** | ||
* Creates a new CustomEvent. | ||
* @param eventType A string representing the event type. | ||
* @param options An options object specifying bubbles:boolean, cancelable:boolean and/or detail:Object information. | ||
* @return A CustomEvent. | ||
*/ | ||
createCustomEvent(eventType: string, options: Object): CustomEvent; | ||
/** | ||
* Dispatches an event on the document. | ||
* @param evt The event to dispatch. | ||
*/ | ||
dispatchEvent(evt: Event): void; | ||
/** | ||
* Gives the values of all the CSS properties of an element after applying the active stylesheets and resolving any basic computation those values may contain. | ||
* @param element The Element for which to get the computed style. | ||
* @return The computed styles. | ||
*/ | ||
getComputedStyle(element: Element): CSSStyleDeclaration; | ||
/** | ||
* Locates an element in the document according to its id. | ||
* @param id The id to search the document for. | ||
* @return The found element. | ||
*/ | ||
getElementById(id: string): Element; | ||
/** | ||
* Performs a query selector on the document and returns all located matches. | ||
* @param query The query to use in searching the document. | ||
* @return A list of all matched elements in the document. | ||
*/ | ||
querySelectorAll(query: string): NodeList; | ||
/** | ||
* Gets the element that is the next sibling of the provided element. | ||
* @param element The element whose next sibling is being located. | ||
* @return The next sibling Element of the provided Element. | ||
*/ | ||
nextElementSibling(element: Node): Element; | ||
/** | ||
* Creates an HTMLTemplateElement using the markup provided. | ||
* @param markup A string containing the markup to turn into a template. Note: This string must contain the template element as well. | ||
* @return The instance of HTMLTemplateElement that was created from the provided markup. | ||
*/ | ||
createTemplateFromMarkup(markup: string): Element; | ||
/** | ||
* Appends a node to the parent, if provided, or the document.body otherwise. | ||
* @param newNode The node to append. | ||
* @param parentNode The node to append to, otherwise the document.body. | ||
*/ | ||
appendNode(newNode: Node, parentNode?: Node): void; | ||
/** | ||
* Replaces a node in the parent with a new node. | ||
* @param newNode The node to replace the old node with. | ||
* @param node The node that is being replaced. | ||
* @param parentNode The node that the current node is parented to. | ||
*/ | ||
replaceNode(newNode: Node, node: Node, parentNode?: Node): void; | ||
/** | ||
* Removes the specified node from the parent node. | ||
* @param node The node to remove. | ||
* @param parentNode The parent node from which the node will be removed. | ||
*/ | ||
removeNode(node: Node, parentNode?: Node): void; | ||
/** | ||
* Injects styles into the destination element, or the document.head if no destination is provided. | ||
* @param styles The css text to injext. | ||
* @param destination The destination element to inject the css text into. If not specified it will default to the document.head. | ||
* @param prepend Indicates whether or not the styles should be prepended to the destination. By default they are appended. | ||
* @return The Style node that was created. | ||
*/ | ||
injectStyles(styles: string, destination?: Element, prepend?: boolean): Node; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Enables discovery of what features the runtime environment supports. | ||
*/ | ||
export interface IFeature { | ||
/** | ||
* Does the runtime environment support ShadowDOM? | ||
*/ | ||
shadowDOM: boolean; | ||
/** | ||
* Does the runtime environment support the css scoped attribute? | ||
*/ | ||
scopedCSS: boolean; | ||
/** | ||
* Does the runtime environment support native HTMLTemplateElement? | ||
*/ | ||
htmlTemplateElement: boolean; | ||
/** | ||
* Does the runtime environment support native DOM mutation observers? | ||
*/ | ||
mutationObserver: boolean; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface IGlobal extends Window { | ||
MutationObserver: typeof MutationObserver; | ||
Element: typeof Element; | ||
SVGElement: typeof SVGElement; | ||
XMLHttpRequest: typeof XMLHttpRequest; | ||
CustomEvent: typeof CustomEvent; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* Initializes the PAL with the NodeJS-targeted implementation. | ||
*/ | ||
export declare function initialize(): void; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { IDom } from './dom'; | ||
import { IGlobal } from './global'; | ||
/** | ||
* Represents the core APIs of the DOM. | ||
*/ | ||
export declare class NodeJsDom implements IDom { | ||
global: IGlobal; | ||
constructor(global: IGlobal); | ||
Element: typeof Element; | ||
SVGElement: typeof SVGElement; | ||
boundary: string; | ||
title: string; | ||
activeElement: Element; | ||
addEventListener(eventName: string, callback: EventListener, capture: boolean): void; | ||
removeEventListener(eventName: string, callback: EventListener, capture: boolean): void; | ||
createElement(tagName: string): Element; | ||
createTextNode(text: string): Text; | ||
createComment(text: string): Comment; | ||
createDocumentFragment(): DocumentFragment; | ||
createMutationObserver(callback: (changes: MutationRecord[], instance: MutationObserver) => void): MutationObserver; | ||
createCustomEvent(eventType: string, options: Object): CustomEvent; | ||
dispatchEvent(evt: Event): void; | ||
getComputedStyle(element: Element): CSSStyleDeclaration; | ||
getElementById(id: string): Element; | ||
querySelectorAll(query: string): NodeList; | ||
nextElementSibling(element: Element): Element; | ||
createTemplateFromMarkup(markup: string): Element; | ||
injectStyles(styles: string, destination?: Element, prepend?: boolean): Node; | ||
adoptNode(node: Node): Node; | ||
appendNode(newNode: Node, parentNode?: Node): void; | ||
replaceNode(newNode: Node, node: Node, parentNode?: Node): void; | ||
removeNode(node: Node, parentNode?: Node): void; | ||
} |