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
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
/** | |
* watch(element, attribute, handler) | |
* - element (Element): Element whose attribute should be watched for changes. | |
* - attribute (String): Attribute to watch. | |
* - handler (Function): Function to execute when the attribute changes. | |
* | |
* `watch` allows DOM Nodes to have their attributes watched for changes. | |
* Internally, this function uses the most efficient mean possible to watch for | |
* the change (more in the **Configuring** section). | |
* |
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
/* | |
MIT license. | |
Copyright (c) 2015 James "Skateside" Long | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
// Shim to make sure that we've got the modern functions and methods that we | |
// need, namely [].forEach, [].map and Object.keys | |
(function () { | |
var undef, // = undefined; | |
isStringArray = 'a'[0] === 'a', // Used in toObject. | |
toString = Object.prototype.toString, // Used for class checking. | |
hasDontEnumBug = !{toSring: null}.propertyIsEnumerable('toString'), |
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
// This is very similar to the standard implimentation of Object.extend but the | |
// important difference here is that this method will not overwrite any existing | |
// method of the source object. This makes it idea for updating native objects. | |
if (!Object.hasOwnProperty('update')) { | |
(function () { | |
'use strict'; | |
var setProp = function (source, property, value) { | |
Object.defineProperty(source, property, { |
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; |
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
/** | |
* 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
var createClass = (function () { | |
'use strict'; | |
// Basic no-operation function | |
var noop = function () { | |
return; | |
}, | |
// Tests to see whether or not regular expressions can be called on |
OlderNewer