This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.ns = function (namespace) { | |
var names = namespace.split('.'), name, i, obj = window; | |
for (i = 0; i < names.length; i++) { | |
name = names[i]; | |
if (!obj[name]) { | |
obj[name] = {}; | |
} | |
obj = obj[name]; | |
} | |
return obj; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global YUITest, CSSLint*/ | |
(function () { | |
var ruleId = 'width-must-be-100px', expectWarning, expectPass; | |
expectWarning = function (ruleset, expectedMessage) { | |
var result, enabledRules = {}; | |
enabledRules[ruleId] = 1; | |
result = CSSLint.verify(ruleset, enabledRules); | |
YUITest.Assert.areEqual(1, result.messages.length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sprintf = function (text) { | |
var i = 1, args = arguments; | |
return text.replace(/%(0)?(\d*)?\.?(\d*)?(s|f)/g, function (pattern) { | |
var a = arguments, | |
precision = +a[3], | |
value = args[i++], | |
padSize = +a[2] - (~~value).toString().length, | |
padding = padSize > 0 ? (new Array(padSize + 1).join(a[1] || ' ')) : ''; | |
return padding + (a[4] === 'f' && a[3] ? value.toFixed(+precision) : value); | |
}); |