js
Javascript
code posted
created at 27 Jun 18:53
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
/** * test function * * @param string * @return string */ function blah(foo, blah) { var test = 25; console.log(test.length); // if foo is true then return this string if (foo === true) { return 'foo is true'; } return 'foo is false'; } $(document).ready(function() { $("table").on("click", "td", function() { console.log('td click'); }); }); window.Rainbow = { whatever: function(param) { }, another: function(param) { } }; window.Rainbow = window.Rainbow || {}; Rainbow.extend('javascript', [ { 'name': 'selector', 'pattern': /\$(?=\.|\()/g } ]); /** * cross browser get attribute for an element * * @see http://stackoverflow.com/questions/3755227/cross-browser-javascript-getattribute-method * * @param {Element} el * @param {string} attr attribute you are trying to get * @returns {string} */ function _attr(el, attr) { var result = (el.getAttribute && el.getAttribute(attr)) || null; if (!result) { var attrs = el.attributes, length = attrs.length, i; for (i = 0; i < length; ++i) { if (attr[i].nodeName === attr) { result = attr[i].nodeValue; } } } return result; } |
1.33 KB in 3 ms with coderay