5 | `
6 |
--------------------------------------------------------------------------------
/test/fixtures/comment.expected.js:
--------------------------------------------------------------------------------
1 | var _div,
2 | _appendChild = require('yo-yoify/lib/appendChild');
3 |
4 | _div = document.createElement('div'), _appendChild(_div, [' ', document.createComment(' important comment text '), ' ']), _div;
--------------------------------------------------------------------------------
/test/fixtures/comment.js:
--------------------------------------------------------------------------------
1 | var html = require('yo-yo')
2 |
3 | html`
4 |
5 |
6 |
7 | `
8 |
9 |
--------------------------------------------------------------------------------
/test/fixtures/dynamicAttr.expected.js:
--------------------------------------------------------------------------------
1 | var _halp,
2 | _str,
3 | _lol,
4 | _abc,
5 | _setAttribute = require('yo-yoify/lib/setAttribute');
6 |
7 | var handler = isTouchDevice ? 'ontouchstart' : 'onmousedown';
8 |
9 | _halp = document.createElement('div'), _halp.setAttribute('id', 'halp'), _setAttribute(_halp, handler, () => {}), _halp.appendChild(document.createTextNode('\n')), _halp;
10 |
11 | var className = 'className';
12 | _str = document.createElement('div'), _str.setAttribute('id', 'str'), _setAttribute(_str, className, 'blub'), _str.appendChild(document.createTextNode('\n')), _str;
13 |
14 | var x = 'disabled';
15 | _lol = document.createElement('button'), _setAttribute(_lol, x, x), _lol.setAttribute('id', 'lol'), _lol.appendChild(document.createTextNode('\n')), _lol;
16 | x = '';
17 | _abc = document.createElement('button'), _setAttribute(_abc, x, x), _abc.setAttribute('id', 'abc'), _abc;
--------------------------------------------------------------------------------
/test/fixtures/dynamicAttr.js:
--------------------------------------------------------------------------------
1 | var bel = require('bel')
2 |
3 | var handler = isTouchDevice ? 'ontouchstart' : 'onmousedown'
4 |
5 | bel`
6 |
{}} />
7 | `
8 |
9 | var className = 'className'
10 | bel`
11 |
12 | `
13 |
14 | var x = 'disabled'
15 | bel`
16 |
17 | `
18 | x = ''
19 | bel`
`
20 |
--------------------------------------------------------------------------------
/test/fixtures/elementsChildren.expected.js:
--------------------------------------------------------------------------------
1 | var _h,
2 | _header,
3 | _appendChild = require('yo-yoify/lib/appendChild');
4 |
5 | const child = (_h = document.createElement('h1'), _h.appendChild(document.createTextNode('Page header')), _h);
6 |
7 | const header = (_header = document.createElement('header'), _appendChild(_header, [child]), _header);
--------------------------------------------------------------------------------
/test/fixtures/elementsChildren.js:
--------------------------------------------------------------------------------
1 | import bel from 'bel'
2 |
3 | const child = bel`
4 |
Page header
5 | `
6 |
7 | const header = bel`
8 |
9 | `
10 |
--------------------------------------------------------------------------------
/test/fixtures/empty.expected.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | var element = void 0;
4 | if (someCondition) {
5 | var _h;
6 |
7 | element = (_h = document.createElement('h1'), _h.appendChild(document.createTextNode('Warning!')), _h);
8 | }
9 | document.body.appendChild(someCondition);
--------------------------------------------------------------------------------
/test/fixtures/empty.js:
--------------------------------------------------------------------------------
1 | var html = require('choo/html')
2 |
3 | var element = html``
4 | if (someCondition) {
5 | element = html`
Warning!
`
6 | }
7 | document.body.appendChild(someCondition)
8 |
9 |
--------------------------------------------------------------------------------
/test/fixtures/events.expected.js:
--------------------------------------------------------------------------------
1 | var _button;
2 |
3 | _button = document.createElement('button'), _button.onclick = event => {
4 | console.log(event);
5 | }, _button.appendChild(document.createTextNode('\n')), _button;
--------------------------------------------------------------------------------
/test/fixtures/events.js:
--------------------------------------------------------------------------------
1 | import bel from 'bel'
2 |
3 | bel`
4 |