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 dom = { | |
toArray: function (nodes) { | |
var array = []; | |
if (nodes) { | |
array = typeof nodes.length === 'number' ? | |
Array.prototype.slice.call(nodes) : |
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
/** | |
* Creates a string of an element, showing the node name and all attributes. | |
* This is mainly useful for debugging in Internet Explorer where a DOM node | |
* representation isn't shown in the console. | |
* | |
* @param {Element} elem Element to stringify. | |
* @return {string} String representation of the element. | |
*/ | |
function stringifyElem(elem) { |
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
/** | |
* Add a handler to check if a class changes on a given element. | |
* The handler will get two arguments: the new class and the old class. | |
* | |
* @param {Element} element Element whos class changes should be watched. | |
* @param {Function} func Function to call when the class changes. | |
*/ | |
var onclasschange = (function () { | |
'use strict'; |
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
/*globals $, document */ | |
/** | |
* A simple shim for the placeholder attribute. | |
*/ | |
if (typeof (document.createElement('input')).placeholder !== 'string') { | |
$(function () { | |
'use strict'; |
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
function forin(obj, fn) { | |
var prop = ''; | |
for (prop in obj) { | |
if (Object.prototype.hasOwnProperty.call(obj, prop)) { | |
fn.call(null, obj[prop], prop, 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
/* | |
General notes: | |
Curly braces around the types seem to be optional. "{number}" works the same as | |
"number". | |
*/ | |
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
/** | |
* Extends one object with another. The object in the first argument is | |
* modified. | |
* | |
* @param {Object} source Source object to extend. | |
* @param {Object} extra Additional properties to add to the source object. | |
* @return {Object} Modified source object. | |
*/ | |
function extendObject(source, extra) { |
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
// Detects whether or not a given CSS selector is supported by the current | |
// browser. | |
// | |
// Takes: | |
// selector (String) The CSS selector to test. | |
// Returns: | |
// (Boolean) true if the selector is supported, false | |
// otherwise. | |
var supportsSelector = (function () { | |
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
/* # Base rules | |
This style sheet attempts to show how CSS selectors can be limited to no more | |
than a single class (although there are exceptions). Keeping to such a | |
restriction helps contain the styling to a module and allows for easier | |
sub-classes of modules. It also enables the surgical classes (below) to work. | |
## Universal rules |
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
// These shims patch methods that the SK80 micro-library uses. References to the | |
// ES5 spec have been included to ensure that the shims are as close to | |
// standards as possible. | |
(function () { | |
'use strict'; | |
var isStringArray = 'a'[0] === 'a', | |
objProto = Object.prototype, | |
toString = objProto.toString; |