This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class SideBar extends HTMLElement { | |
| static render({ name } = props) { | |
| return <div>{name}</div>; | |
| } | |
| } | |
| customElements.define('side-bar', SideBar); | |
| export class ListView extends HTMLElement { | |
| static render({ items } = props) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var request = require('request'); | |
| var dom5 = require('dom5'); | |
| var argv = require('minimist')(process.argv.slice(2)); | |
| var app = express(); | |
| const PORT = process.env.PORT || argv.p || argv.port; | |
| function removeNode(node) { | |
| if (node) { | |
| dom5.remove(node); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>Responsive Grid</title> | |
| <style> | |
| body { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dom-module id="x-test"> | |
| <template> | |
| <div>[[test]]</div> | |
| </template> | |
| <script> | |
| Polymer({ | |
| is: 'x-test', | |
| properties: { | |
| test: { | |
| type: String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dom-module id="x-foo"> | |
| <div>test</div> | |
| </dom-module> | |
| <script> | |
| Polymer.X_CONSTANT = 1; | |
| Polymer({ | |
| is: 'x-foo', | |
| properties: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Recursive depth first search | |
| function RecursiveDFSTraversal(root, fn, fnArgs) { | |
| if (!root) { | |
| return; | |
| } | |
| fnArgs = fn(root, fnArgs); | |
| for (var i = 0; fnArgs && i < root.children.length; i++) { | |
| RecursiveDFSTraversal(root.children[i], fn, fnArgs); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Iterative depth first search | |
| function IterativeDFSTraversal(root, fn, fnArgs) { | |
| var stack = [], nodeIdx = [], stackFrameArgs = []; | |
| fnArgs = fn(root, fnArgs); | |
| if (fnArgs) { | |
| stack.push(root); | |
| nodeIdx.push(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function checkSelector(node, selectors) { | |
| if (selectors.length === 0) { | |
| return false; | |
| } | |
| var currentSel = selectors.shift(); | |
| if (currentSel === '>') { | |
| return checkSelector(node, selectors); | |
| } | |
| if (currentSel.charAt(0) === '.' && node.classList.contains(currentSel.substr(1))) { | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getElementsStampedByDomRepeat(domRepeat) { | |
| return [].slice.call(domRepeat.parentElement.children).reduce(function(arr, child) { | |
| if (domRepeat.modelForElement(child)) { | |
| arr.push(child); | |
| } | |
| return arr; | |
| }, []); | |
| } |