From b429735e864ca3331a362615470dd43276bfb0c6 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 20 Aug 2017 13:10:16 -0500 Subject: [PATCH] Use loader script to load beautify --- edit/edit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/edit/edit.js b/edit/edit.js index b0f78539..e47d8b84 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -1,6 +1,6 @@ /* eslint brace-style: 0, operator-linebreak: 0 */ /* global CodeMirror parserlib */ -/* global exports css_beautify */ +/* global exports css_beautify onDOMscripted */ /* global CSSLint initLint getLinterConfigForCodeMirror updateLintReport renderLintReport updateLinter */ 'use strict'; @@ -1058,9 +1058,9 @@ function getEditorInSight(nearbyElement) { } function beautify(event) { - const script = document.head.appendChild(document.createElement('script')); - script.src = 'vendor-overwrites/beautify/beautify-css-mod.js'; - script.onload = doBeautify; + const script = $('script[src*="beautify-css-mod"]') ? + [] : ['vendor-overwrites/beautify/beautify-css-mod.js']; + onDOMscripted(script).then(doBeautify); function doBeautify() { const tabs = prefs.get('editor.indentWithTabs');