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
describe('Element.get/set/erase property exaustive', (function(){ | |
var tagsAttrs = { | |
label: ['for'], | |
input: ['data-something', 'id', 'name', 'value', 'maxLength', 'readOnly', 'defaultValue', 'accessKey', 'checked', 'disabled', 'multiple', 'selected', 'noresize', 'onkeypress', 'onkeydown', 'onkeyup'], | |
button: ['type'], // theres a bug on safari while using type as an expando (el.type) with button elements | |
a: ['href', 'title', 'text', 'class', 'html', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout'], | |
img: ['src', 'ismap', 'useMap', 'tabIndex'], | |
table: ['cellPadding', 'cellSpacing'], | |
td: ['colSpan', 'rowSpan'], | |
iframe: ['frameBorder'], |
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 implement = function(key, value, retain){ | |
if (Class.Mutators.hasOwnProperty(key)){ | |
var mutator = Class.Mutators[key]; | |
value = mutator.call(this, value); | |
if (value == null) return this; | |
} | |
if (typeOf(value) == 'function'){ | |
if (value.$hidden) return this; |
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
Type.isEnumerable = function(item){ | |
return (typeof item != 'object' && typeof item != 'string' && typeof item.length == '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
if (!Browser.Element){ | |
Element.parent = Object; | |
Element.ProtoType = {'$family': function(){ return 'element'; }.hide()}; | |
Element.mirror(function(name, method){ | |
Element.ProtoType[name] = method; | |
}); | |
} |
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
/* | |
--- | |
script: Elements.From.js | |
description: Returns a collection of elements from a string of html. | |
license: MIT-style license | |
requires: [Element] |
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 getParent = function(expression){ | |
var parsed = Slick.parse(expression); | |
parsed = parsed && parsed.expressions; | |
for (var i = parsed.length; i--;){ | |
parsed[i][0] = '!'; | |
} | |
return Slick.find(this, parsed); | |
}; |
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(context){ | |
var Configuration = context.Configuration = {}; | |
Configuration.name = 'MooTools Slick'; | |
Configuration.presets = { | |
'slick-1.0': { | |
sets: ['1.0'], | |
helpers: ['1.0'], |
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
// live demo: http://jsbin.com/oxuri5/9 | |
var div = document.createElement('div'); | |
div.setAttribute('attr', 'test'); | |
console.log(div.msMatchesSelector('[attr="test"]'), ' should be true'); | |
console.log(div.msMatchesSelector('[attr^="test"]'), ' should be true'); | |
console.log(div.msMatchesSelector('[attr$="test"]'), ' should be true'); | |
document.body.appendChild(div); | |
console.log(div.msMatchesSelector('[attr="test"]'), ' should be true'); | |
console.log(div.msMatchesSelector('[attr^="test"]'), ' should be true'); |
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 crypto = require("crypto"); | |
var repeat = function(str, times){ | |
var _str = str; | |
while(--times){ | |
str += _str; | |
} | |
return str; | |
}; |
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
/* | |
--- | |
Port from the YUI3 event-simulate functionality to vanilla javascript. | |
... | |
*/ | |
(function(global, document){ | |
var mix = function(obj1, obj2){ | |
for (var key in obj2){ | |
obj1[key] = obj2[key]; |