BVB Source Codes

prettier Show traversal.js Source code

Return Download prettier: download traversal.js Source code - Download prettier Source code - Type:.js
  1. // @flow
  2.  
  3. let tests = [
  4.   // basic functionality
  5.   function() {
  6.     const i: NodeIterator<*,*> = document.createNodeIterator(document.body);
  7.     const filter: NodeFilter = i.filter;
  8.     const response:
  9.       typeof NodeFilter.FILTER_ACCEPT |
  10.       typeof NodeFilter.FILTER_REJECT |
  11.       typeof NodeFilter.FILTER_SKIP =
  12.       filter.acceptNode(document.body);
  13.   },
  14.   function() {
  15.     const w: TreeWalker<*,*> = document.createTreeWalker(document.body);
  16.     const filter: NodeFilter = w.filter;
  17.     const response:
  18.       typeof NodeFilter.FILTER_ACCEPT |
  19.       typeof NodeFilter.FILTER_REJECT |
  20.       typeof NodeFilter.FILTER_SKIP =
  21.       filter.acceptNode(document.body);
  22.   },
  23.   // rootNode must be a Node
  24.   function() {
  25.     document.createNodeIterator(document.body); // valid
  26.     document.createNodeIterator({}); // invalid
  27.   },
  28.   function() {
  29.     document.createTreeWalker(document.body);
  30.     document.createTreeWalker({}); // invalid
  31.   },
  32.   // Type Parameters
  33.   function() {
  34.     const _root = document.body;
  35.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_ELEMENT);
  36.     const root: typeof _root = i.root;
  37.     const referenceNode: typeof _root | Element = i.referenceNode;
  38.     const previousNode: Element | null = i.previousNode();
  39.     const nextNode: Element | null = i.nextNode();
  40.   },
  41.   function() {
  42.     const _root = document.body.attributes[0];
  43.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_ATTRIBUTE);
  44.     const root: typeof _root = i.root;
  45.     const referenceNode: typeof _root | Attr = i.referenceNode
  46.     const previousNode: Attr | null = i.previousNode();
  47.     const nextNode: Attr | null = i.nextNode();
  48.   },
  49.   function() {
  50.     const _root = document.body;
  51.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_TEXT);
  52.     const root: typeof _root = i.root;
  53.     const referenceNode: typeof _root | Text = i.referenceNode;
  54.     const previousNode: Text | null = i.previousNode();
  55.     const nextNode: Text | null = i.nextNode();
  56.   },
  57.   function() {
  58.     const _root = document;
  59.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_DOCUMENT);
  60.     const root: typeof _root = i.root;
  61.     const referenceNode: typeof _root | Document = i.referenceNode;
  62.     const previousNode: Document | null = i.previousNode();
  63.     const nextNode: Document | null = i.nextNode();
  64.   },
  65.   function() {
  66.     const _root = document;
  67.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_DOCUMENT_TYPE);
  68.     const root: typeof _root = i.root;
  69.     const referenceNode: typeof _root | DocumentType = i.referenceNode;
  70.     const previousNode: DocumentType | null = i.previousNode();
  71.     const nextNode: DocumentType | null = i.nextNode();
  72.   },
  73.   function() {
  74.     const _root = document.createDocumentFragment();
  75.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_DOCUMENT_FRAGMENT);
  76.     const root: typeof _root = i.root;
  77.     const referenceNode: typeof _root | DocumentFragment = i.referenceNode;
  78.     const previousNode: DocumentFragment | null = i.previousNode();
  79.     const nextNode: DocumentFragment | null = i.nextNode();
  80.   },
  81.   function() {
  82.     const _root = document.body;
  83.     const i = document.createNodeIterator(_root, NodeFilter.SHOW_ALL);
  84.     const root: typeof _root = i.root;
  85.     const referenceNode: typeof _root | Node = i.referenceNode;
  86.     const previousNode: Node | null = i.previousNode();
  87.     const nextNode: Node | null = i.nextNode();
  88.   },
  89.   function() {
  90.     const _root = document.body;
  91.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_ELEMENT);
  92.     const root: typeof _root = w.root;
  93.     const currentNode: typeof _root | Element = w.currentNode;
  94.     const parentNode: Element | null = w.parentNode();
  95.     const firstChild: Element | null = w.firstChild();
  96.     const lastChild: Element | null = w.lastChild();
  97.     const previousSibling: Element | null = w.previousSibling();
  98.     const nextSibling: Element | null = w.nextSibling();
  99.     const previousNode: Element | null = w.previousNode();
  100.     const nextNode: Element | null = w.nextNode();
  101.   },
  102.   function() {
  103.     const _root = document.body.attributes[0];
  104.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_ATTRIBUTE);
  105.     const root: typeof _root = w.root;
  106.     const currentNode: typeof _root | Attr = w.currentNode;
  107.     const parentNode: Attr | null = w.parentNode();
  108.     const firstChild: Attr | null = w.firstChild();
  109.     const lastChild: Attr | null = w.lastChild();
  110.     const previousSibling: Attr | null = w.previousSibling();
  111.     const nextSibling: Attr | null = w.nextSibling();
  112.     const previousNode: Attr | null = w.previousNode();
  113.     const nextNode: Attr | null = w.nextNode();
  114.   },
  115.   function() {
  116.     const _root = document.body;
  117.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_TEXT);
  118.     const root: typeof _root = w.root;
  119.     const currentNode: typeof _root | Text = w.currentNode;
  120.     const parentNode: Text | null = w.parentNode();
  121.     const firstChild: Text | null = w.firstChild();
  122.     const lastChild: Text | null = w.lastChild();
  123.     const previousSibling: Text | null = w.previousSibling();
  124.     const nextSibling: Text | null = w.nextSibling();
  125.     const previousNode: Text | null = w.previousNode();
  126.     const nextNode: Text | null = w.nextNode();
  127.   },
  128.   function() {
  129.     const _root = document;
  130.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_DOCUMENT);
  131.     const root: typeof _root = w.root;
  132.     const currentNode: typeof _root | Document = w.currentNode;
  133.     const parentNode: Document | null = w.parentNode();
  134.     const firstChild: Document | null = w.firstChild();
  135.     const lastChild: Document | null = w.lastChild();
  136.     const previousSibling: Document | null = w.previousSibling();
  137.     const nextSibling: Document | null = w.nextSibling();
  138.     const previousNode: Document | null = w.previousNode();
  139.     const nextNode: Document | null = w.nextNode();
  140.   },
  141.   function() {
  142.     const _root = document;
  143.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_DOCUMENT_TYPE);
  144.     const root: typeof _root = w.root;
  145.     const currentNode: typeof _root | DocumentType = w.currentNode;
  146.     const parentNode: DocumentType | null = w.parentNode();
  147.     const firstChild: DocumentType | null = w.firstChild();
  148.     const lastChild: DocumentType | null = w.lastChild();
  149.     const previousSibling: DocumentType | null = w.previousSibling();
  150.     const nextSibling: DocumentType | null = w.nextSibling();
  151.     const previousNode: DocumentType | null = w.previousNode();
  152.     const nextNode: DocumentType | null = w.nextNode();
  153.   },
  154.   function() {
  155.     const _root = document.createDocumentFragment();
  156.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_DOCUMENT_FRAGMENT);
  157.     const root: typeof _root = w.root;
  158.     const currentNode: typeof _root | DocumentFragment = w.currentNode;
  159.     const parentNode: DocumentFragment | null = w.parentNode();
  160.     const firstChild: DocumentFragment | null = w.firstChild();
  161.     const lastChild: DocumentFragment | null = w.lastChild();
  162.     const previousSibling: DocumentFragment | null = w.previousSibling();
  163.     const nextSibling: DocumentFragment | null = w.nextSibling();
  164.     const previousNode: DocumentFragment | null = w.previousNode();
  165.     const nextNode: DocumentFragment | null = w.nextNode();
  166.   },
  167.   function() {
  168.     const _root = document.body;
  169.     const w = document.createTreeWalker(_root, NodeFilter.SHOW_ALL);
  170.     const root: typeof _root = w.root;
  171.     const currentNode: typeof _root | Node = w.currentNode;
  172.     const parentNode: Node | null = w.parentNode();
  173.     const firstChild: Node | null = w.firstChild();
  174.     const lastChild: Node | null = w.lastChild();
  175.     const previousSibling: Node | null = w.previousSibling();
  176.     const nextSibling: Node | null = w.nextSibling();
  177.     const previousNode: Node | null = w.previousNode();
  178.     const nextNode: Node | null = w.nextNode();
  179.   },
  180.   // NodeFilterInterface
  181.   function() {
  182.     document.createNodeIterator(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid
  183.     document.createNodeIterator(document.body, -1, node => 'accept'); // invalid
  184.     document.createNodeIterator(document.body, -1, { acceptNode: node => NodeFilter.FILTER_ACCEPT }); // valid
  185.     document.createNodeIterator(document.body, -1, { acceptNode: node => 'accept' }); // invalid
  186.     document.createNodeIterator(document.body, -1, {}); // invalid
  187.   },
  188.   function() {
  189.     document.createTreeWalker(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid
  190.     document.createTreeWalker(document.body, -1, node => 'accept'); // invalid
  191.     document.createTreeWalker(document.body, -1, { acceptNode: node => NodeFilter.FILTER_ACCEPT }); // valid
  192.     document.createTreeWalker(document.body, -1, { acceptNode: node => 'accept' }); // invalid
  193.     document.createTreeWalker(document.body, -1, {}); // invalid
  194.   },
  195. ];
  196.  
downloadtraversal.js Source code - Download prettier Source code
Related Source Codes/Software:
storybook - 2017-06-07
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top