21 8 / 2012

placeholderSupport = ("placeholder" in document.createElement("input"));
 
if(!placeholderSupport){
  //This browser does not support the placeholder attribute
  //use javascript instead
}

Forma rapidita de comprobar si un navegador soporta determinados atributos sin recurrir a Modernizr. Quien dice “placeholder” dice “autofocus”, por ejemplo.

04 10 / 2011

Otra librería Javascript de 4Kb. Tiene buena pinta.

Features:

  • CSS-based selection engine
  • Cross-browser event handling
  • Asynchronous loading of other Javascript
  • AJAX and JSON decoding
  • Animation with easing and custom functions
  • DOM manipulation
  • Style manipulation
  • Calculation of element size and position
  • Attribute and class manipulation
  • Familiar method chaining syntax

01 10 / 2011

breakbit:

Here’s a clever one, I didn’t come up with it, but I sure want to disseminate it further.

Why bother with regular expressions and stuff when the browsers are more than suitable for the job:

String.prototype.strip_html = function() { var tmp = document.createElement("DIV"); tmp.innerHTML = this;...

16 9 / 2011

05 9 / 2011

11 9 / 2010

24 6 / 2010