Permalink
Browse files

Changed the way we handle setup() for script tags without data-for so…

… that it's not injecting dummy DOM containers when it shouldn't be.
  • Loading branch information...
SirRawlins committed Aug 20, 2018
1 parent e5191ba commit 98eb2227e690d74418fb0de7f0af7880af716916
Showing with 57 additions and 51 deletions.
  1. +27 −24 dist/status-bar.js
  2. +2 −2 dist/status-bar.min.js
  3. +1 −1 dist/status-bar.min.js.map
  4. +27 −24 src/javascripts/status-bar.js
@@ -29241,30 +29241,33 @@ module.exports = function is(a, b, options) {
var script_tag = $($('script[src$="status-bar.min.js"]')[0]);
// Determine any pages assigned to the script tag.
// Default to no pages if we don't find any.
var pages = script_tag.data("for") || "";
// Loop over all pages assigned on the including script tag.
// TODO: Can we abstract this out into a separate method?
$(pages.split(",")).each(function() {
// Check to see if a status bar locator is present.
if($('[data-status-bar-for="' + this + '"]').length === 0) {
// We don't have a container / locator for our status bar
// so we need to inject one into the DOM near the opening
// body tag.
var div_tag = $('<div />', {
// Set the class on the new tag.
'class': 'sorry-status-bar',
// Copy the reference to the status page.
'data-status-bar-for': this,
// Copy the other data attributes.
// TODO: Can we dynamically copy all of them?
'data-filter-type': script_tag.data("filter-type"),
'data-filter-components': script_tag.data("filter-components"),
'data-dismissible': script_tag.data("dismissible")
// Attach it to the body.
}).prependTo('body');
}
});
var pages = script_tag.data("for");
// See if any 'for' pages defined.
if (typeof pages !== 'undefined') {
// Loop over all pages assigned on the including script tag.
// TODO: Can we abstract this out into a separate method?
$(pages.split(",")).each(function() {
// Check to see if a status bar locator is present.
if($('[data-status-bar-for="' + this + '"]').length === 0) {
// We don't have a container / locator for our status bar
// so we need to inject one into the DOM near the opening
// body tag.
var div_tag = $('<div />', {
// Set the class on the new tag.
'class': 'sorry-status-bar',
// Copy the reference to the status page.
'data-status-bar-for': this,
// Copy the other data attributes.
// TODO: Can we dynamically copy all of them?
'data-filter-type': script_tag.data("filter-type"),
'data-filter-components': script_tag.data("filter-components"),
'data-dismissible': script_tag.data("dismissible")
// Attach it to the body.
}).prependTo('body');
}
});
}
};
// Data-Api

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -402,30 +402,33 @@
var script_tag = $($('script[src$="status-bar.min.js"]')[0]);
// Determine any pages assigned to the script tag.
// Default to no pages if we don't find any.
var pages = script_tag.data("for") || "";
// Loop over all pages assigned on the including script tag.
// TODO: Can we abstract this out into a separate method?
$(pages.split(",")).each(function() {
// Check to see if a status bar locator is present.
if($('[data-status-bar-for="' + this + '"]').length === 0) {
// We don't have a container / locator for our status bar
// so we need to inject one into the DOM near the opening
// body tag.
var div_tag = $('<div />', {
// Set the class on the new tag.
'class': 'sorry-status-bar',
// Copy the reference to the status page.
'data-status-bar-for': this,
// Copy the other data attributes.
// TODO: Can we dynamically copy all of them?
'data-filter-type': script_tag.data("filter-type"),
'data-filter-components': script_tag.data("filter-components"),
'data-dismissible': script_tag.data("dismissible")
// Attach it to the body.
}).prependTo('body');
}
});
var pages = script_tag.data("for");
// See if any 'for' pages defined.
if (typeof pages !== 'undefined') {
// Loop over all pages assigned on the including script tag.
// TODO: Can we abstract this out into a separate method?
$(pages.split(",")).each(function() {
// Check to see if a status bar locator is present.
if($('[data-status-bar-for="' + this + '"]').length === 0) {
// We don't have a container / locator for our status bar
// so we need to inject one into the DOM near the opening
// body tag.
var div_tag = $('<div />', {
// Set the class on the new tag.
'class': 'sorry-status-bar',
// Copy the reference to the status page.
'data-status-bar-for': this,
// Copy the other data attributes.
// TODO: Can we dynamically copy all of them?
'data-filter-type': script_tag.data("filter-type"),
'data-filter-components': script_tag.data("filter-components"),
'data-dismissible': script_tag.data("dismissible")
// Attach it to the body.
}).prependTo('body');
}
});
}
};
// Data-Api

0 comments on commit 98eb222

Please sign in to comment.