Skip to content

Commit

Permalink
Merge pull request #1181 from stealjs/attr-name
Browse files Browse the repository at this point in the history
Use attr.name to get an attribute's name
  • Loading branch information
matthewp authored Apr 25, 2017
2 parents 0988858 + c6233bc commit ba6c847
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
7 changes: 4 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1404,11 +1404,12 @@ addStealExtension(function (loader) {
scriptOptions.stealURL = script.src;

each(script.attributes, function(attr){
var nodeName = attr.nodeName || attr.name;
// get option, remove "data" and camelize
var optionName =
camelize( attr.nodeName.indexOf("data-") === 0 ?
attr.nodeName.replace("data-","") :
attr.nodeName );
camelize( nodeName.indexOf("data-") === 0 ?
nodeName.replace("data-","") :
nodeName );
// make options uniform e.g. baseUrl => baseURL
optionName = optionName.replace(urlRegEx, "URL")
scriptOptions[optionName] = (attr.value === "") ? true : attr.value;
Expand Down
7 changes: 4 additions & 3 deletions src/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
scriptOptions.stealURL = script.src;

each(script.attributes, function(attr){
var nodeName = attr.nodeName || attr.name;
// get option, remove "data" and camelize
var optionName =
camelize( attr.nodeName.indexOf("data-") === 0 ?
attr.nodeName.replace("data-","") :
attr.nodeName );
camelize( nodeName.indexOf("data-") === 0 ?
nodeName.replace("data-","") :
nodeName );
// make options uniform e.g. baseUrl => baseURL
optionName = optionName.replace(urlRegEx, "URL")
scriptOptions[optionName] = (attr.value === "") ? true : attr.value;
Expand Down
7 changes: 4 additions & 3 deletions steal-sans-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -5705,11 +5705,12 @@ addStealExtension(function (loader) {
scriptOptions.stealURL = script.src;

each(script.attributes, function(attr){
var nodeName = attr.nodeName || attr.name;
// get option, remove "data" and camelize
var optionName =
camelize( attr.nodeName.indexOf("data-") === 0 ?
attr.nodeName.replace("data-","") :
attr.nodeName );
camelize( nodeName.indexOf("data-") === 0 ?
nodeName.replace("data-","") :
nodeName );
// make options uniform e.g. baseUrl => baseURL
optionName = optionName.replace(urlRegEx, "URL")
scriptOptions[optionName] = (attr.value === "") ? true : attr.value;
Expand Down
2 changes: 1 addition & 1 deletion steal-sans-promises.production.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions steal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6975,11 +6975,12 @@ addStealExtension(function (loader) {
scriptOptions.stealURL = script.src;

each(script.attributes, function(attr){
var nodeName = attr.nodeName || attr.name;
// get option, remove "data" and camelize
var optionName =
camelize( attr.nodeName.indexOf("data-") === 0 ?
attr.nodeName.replace("data-","") :
attr.nodeName );
camelize( nodeName.indexOf("data-") === 0 ?
nodeName.replace("data-","") :
nodeName );
// make options uniform e.g. baseUrl => baseURL
optionName = optionName.replace(urlRegEx, "URL")
scriptOptions[optionName] = (attr.value === "") ? true : attr.value;
Expand Down
2 changes: 1 addition & 1 deletion steal.production.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/npm/bower/node_modules/steal/steal.production.js

Large diffs are not rendered by default.

0 comments on commit ba6c847

Please sign in to comment.