Skip to content

Commit

Permalink
fix(use strict): Fix "use strict"
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonC authored and SimeonC committed Mar 15, 2015
1 parent 3816c05 commit f9bfcd3
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = function (grunt) {
},
concat: {
options: {
banner: "/*\n@license textAngular\nAuthor : Austin Anderson\nLicense : 2013 MIT\nVersion <%- pkg.version %>\n\nSee README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.\n*/\n\n(function(){ // encapsulate all variables so they don't become global vars\n\"Use Strict\";",
banner: "/*\n@license textAngular\nAuthor : Austin Anderson\nLicense : 2013 MIT\nVersion <%- pkg.version %>\n\nSee README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.\n*/\n\n(function(){ // encapsulate all variables so they don't become global vars\n\"use strict\";",
footer: "})();"
},
dist: {
Expand Down
2 changes: 1 addition & 1 deletion dist/textAngular.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions lib/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ angular.module('textAngular.factories', [])
var styleMatch = [];
for(var i = 0; i < convert_infos.length; i++){
var _partialStyle = '(' + convert_infos[i].property + ':\\s*(';
for(j = 0; j < convert_infos[i].values.length; j++){
for(var j = 0; j < convert_infos[i].values.length; j++){
/* istanbul ignore next: not needed to be tested yet */
if(j > 0) _partialStyle += '|';
_partialStyle += convert_infos[i].values[j];
Expand Down Expand Up @@ -112,7 +112,7 @@ angular.module('textAngular.factories', [])
if(!html || !angular.isString(html) || html.length <= 0) return html;
var i;
var styleElementMatch = /<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/ig;
var match, styleVal, newTag, lastNewTag = '', newHtml, finalHtml = '', lastIndex = 0;
var match, subMatch, styleVal, newTag, lastNewTag = '', newHtml, finalHtml = '', lastIndex = 0;
while(match = styleElementMatch.exec(html)){
// one of the quoted values ' or "
/* istanbul ignore next: quotations match */
Expand Down Expand Up @@ -168,7 +168,7 @@ angular.module('textAngular.factories', [])
// record last index after this tag
lastIndex = match.index + match[0].length;
// construct tag without the align attribute
newTag = '<' + match[1] + match[5];
var newTag = '<' + match[1] + match[5];
// add the style attribute
if(/style=("([^"]+)"|'([^']+)')/ig.test(newTag)){
/* istanbul ignore next: quotations match */
Expand Down Expand Up @@ -211,7 +211,7 @@ angular.module('textAngular.factories', [])
// Do processing for <pre> tags, removing tabs and return carriages outside of them

var _preTags = safe.match(/(<pre[^>]*>.*?<\/pre[^>]*>)/ig);
processedSafe = safe.replace(/(&#(9|10);)*/ig, '');
var processedSafe = safe.replace(/(&#(9|10);)*/ig, '');
var re = /<pre[^>]*>.*?<\/pre[^>]*>/ig;
var index = 0;
var lastIndex = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function validElementString(string){
Custom stylesheet for the placeholders rules.
Credit to: http://davidwalsh.name/add-rules-stylesheets
*/
var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule;
var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule, _getRuleIndex;
/* istanbul ignore else: IE <8 test*/
if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
var _sheets = document.styleSheets;
Expand Down
1 change: 1 addition & 0 deletions lib/taBind.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
}
/* istanbul ignore next: difficult to test as can't seem to select */
}else if(event.keyCode === 13 && !event.shiftKey){
var $selection;
var selection = taSelection.getSelectionElement();
if(!selection.tagName.match(VALIDELEMENTS)) return;
var _new = angular.element(_defaultVal);
Expand Down
13 changes: 7 additions & 6 deletions src/textAngular.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See README.md or https://github.com/fraywing/textAngular/wiki for requirements a
*/

(function(){ // encapsulate all variables so they don't become global vars
"Use Strict";
"use strict";
// IE version detection - http://stackoverflow.com/questions/4169160/javascript-ie-detection-why-not-use-simple-conditional-comments
// We need this as IE sometimes plays funny tricks with the contenteditable.
// ----------------------------------------------------------
Expand Down Expand Up @@ -98,7 +98,7 @@ function validElementString(string){
Custom stylesheet for the placeholders rules.
Credit to: http://davidwalsh.name/add-rules-stylesheets
*/
var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule;
var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule, _getRuleIndex;
/* istanbul ignore else: IE <8 test*/
if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
var _sheets = document.styleSheets;
Expand Down Expand Up @@ -261,7 +261,7 @@ angular.module('textAngular.factories', [])
var styleMatch = [];
for(var i = 0; i < convert_infos.length; i++){
var _partialStyle = '(' + convert_infos[i].property + ':\\s*(';
for(j = 0; j < convert_infos[i].values.length; j++){
for(var j = 0; j < convert_infos[i].values.length; j++){
/* istanbul ignore next: not needed to be tested yet */
if(j > 0) _partialStyle += '|';
_partialStyle += convert_infos[i].values[j];
Expand Down Expand Up @@ -294,7 +294,7 @@ angular.module('textAngular.factories', [])
if(!html || !angular.isString(html) || html.length <= 0) return html;
var i;
var styleElementMatch = /<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/ig;
var match, styleVal, newTag, lastNewTag = '', newHtml, finalHtml = '', lastIndex = 0;
var match, subMatch, styleVal, newTag, lastNewTag = '', newHtml, finalHtml = '', lastIndex = 0;
while(match = styleElementMatch.exec(html)){
// one of the quoted values ' or "
/* istanbul ignore next: quotations match */
Expand Down Expand Up @@ -350,7 +350,7 @@ angular.module('textAngular.factories', [])
// record last index after this tag
lastIndex = match.index + match[0].length;
// construct tag without the align attribute
newTag = '<' + match[1] + match[5];
var newTag = '<' + match[1] + match[5];
// add the style attribute
if(/style=("([^"]+)"|'([^']+)')/ig.test(newTag)){
/* istanbul ignore next: quotations match */
Expand Down Expand Up @@ -393,7 +393,7 @@ angular.module('textAngular.factories', [])
// Do processing for <pre> tags, removing tabs and return carriages outside of them

var _preTags = safe.match(/(<pre[^>]*>.*?<\/pre[^>]*>)/ig);
processedSafe = safe.replace(/(&#(9|10);)*/ig, '');
var processedSafe = safe.replace(/(&#(9|10);)*/ig, '');
var re = /<pre[^>]*>.*?<\/pre[^>]*>/ig;
var index = 0;
var lastIndex = 0;
Expand Down Expand Up @@ -1456,6 +1456,7 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
}
/* istanbul ignore next: difficult to test as can't seem to select */
}else if(event.keyCode === 13 && !event.shiftKey){
var $selection;
var selection = taSelection.getSelectionElement();
if(!selection.tagName.match(VALIDELEMENTS)) return;
var _new = angular.element(_defaultVal);
Expand Down
2 changes: 1 addition & 1 deletion test/taFixChrome.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('taFixChrome', function(){
'Use Strict';
'use strict';
beforeEach(module('textAngular'));
var taFixChrome;
beforeEach(inject(function(_taFixChrome_){
Expand Down

0 comments on commit f9bfcd3

Please sign in to comment.