Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
fix: use appendChild instead of append for IE/Edge (#73)
Browse files Browse the repository at this point in the history
Should work in IE/Edge now
  • Loading branch information
yhuard authored and emeryro committed Mar 11, 2019
1 parent 7c0cda6 commit f715894
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports = {
node: true,
browser: true,
},
rules: {
'unicorn/prefer-node-append': false,
},
overrides: [
{
files: ['src/**/*.{story,test}.js'],
Expand Down
6 changes: 3 additions & 3 deletions src/ec/packages/ec-component-accordion/accordion.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ storiesOf('Components/Accordion', module)

const htmlElement = document.createElement('div');
htmlElement.innerHTML = html.trim();
demo.append(htmlElement.firstChild);
demo.appendChild(htmlElement.firstChild);

const scriptElement = document.createElement('script');
scriptElement.innerHTML = `
Expand All @@ -44,9 +44,9 @@ storiesOf('Components/Accordion', module)
for (var i = 0; i < elements.length; i += 1) {
var accordion = new ECL.Accordion(elements[i]);
accordion.init();
}
}
`;
demo.append(scriptElement);
demo.appendChild(scriptElement);

return demo;
},
Expand Down
4 changes: 2 additions & 2 deletions src/ec/packages/ec-component-breadcrumb/breadcrumb.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ storiesOf('Components/Breadcrumb', module)

const htmlElement = document.createElement('div');
htmlElement.innerHTML = html.trim();
demo.append(htmlElement.firstChild);
demo.appendChild(htmlElement.firstChild);

const scriptElement = document.createElement('script');
scriptElement.innerHTML = `
var breadcrumbElement = document.querySelector("[data-ecl-breadcrumb]");
var breadcrumb = new ECL.Breadcrumb(breadcrumbElement);
breadcrumb.init();
`;
demo.append(scriptElement);
demo.appendChild(scriptElement);

return demo;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ storiesOf('Components/Contextual Navigation', module)

const htmlElement = document.createElement('div');
htmlElement.innerHTML = html.trim();
demo.append(htmlElement.firstChild);
demo.appendChild(htmlElement.firstChild);

const scriptElement = document.createElement('script');
scriptElement.innerHTML = `
var element = document.querySelector('[data-ecl-contextual-navigation]');
var contextualNavigation = new ECL.ContextualNavigation(element);
contextualNavigation.init();
`;
demo.append(scriptElement);
demo.appendChild(scriptElement);

return demo;
},
Expand Down
4 changes: 2 additions & 2 deletions src/ec/packages/ec-component-expandable/expandable.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ storiesOf('Components/Expandable', module)

const htmlElement = document.createElement('div');
htmlElement.innerHTML = html.trim();
demo.append(htmlElement.firstChild);
demo.appendChild(htmlElement.firstChild);

const scriptElement = document.createElement('script');
scriptElement.innerHTML = `
var expandableElement = document.querySelector('[data-ecl-expandable]');
var expandable = new ECL.Expandable(expandableElement);
expandable.init();
`;
demo.append(scriptElement);
demo.appendChild(scriptElement);

return demo;
},
Expand Down
4 changes: 2 additions & 2 deletions src/ec/packages/ec-component-file/file.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ storiesOf('Components/File', module)

const htmlElement = document.createElement('div');
htmlElement.innerHTML = html.trim();
demo.append(htmlElement.firstChild);
demo.appendChild(htmlElement.firstChild);

const scriptElement = document.createElement('script');
scriptElement.innerHTML = `
var fileElement = document.querySelector("[data-ecl-file]");
var file = new ECL.FileDownload(fileElement);
file.init();
`;
demo.append(scriptElement);
demo.appendChild(scriptElement);

return demo;
},
Expand Down
2 changes: 1 addition & 1 deletion utils/storybook-addon-code/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const withCode = makeDecorator({
code = story;
} else if (story instanceof DocumentFragment) {
const htmlElement = document.createElement('div');
htmlElement.append(story.cloneNode(true));
htmlElement.appendChild(story.cloneNode(true));
code = htmlElement.innerHTML;
} else if (story instanceof Node) {
code = story.outerHTML;
Expand Down

0 comments on commit f715894

Please sign in to comment.