JSFiddle

  • box-sizing min-height bug. #27 is the latest revision

    Elements with box-sizing: border-box and min-height set do not act the same in Firefox and IE as the other browsers.

    function paddingAddedToMinHeight() {
        // create an element, set box-sizing to 
        // border-box as well as absolutely position
        // the element off the screen.
        var ...
  • XSS Example using document.createElement #101 is the latest revision

    jQuery 1.7.2, HTML, CSS, JavaScript

    function strip(html)
    {
       var tmp = document.createElement("DIV");
       tmp.innerHTML = html;
       return tmp.textContent||tmp.innerText;
    }
    
    
    strip("<img onerror='alert(\"could run arbitrary JS here\")' src=bogus>");
    
    
  • localStorage inconsistencies across browsers #19 is the latest revision

    A series of MochaTest unit tests showing inconsistencies in removing items from localStorage.

    /*globals mocha: true, describe: true, it: true, beforeEach:true */
    (function() {
        function assert(expr, msg) {
            if (!expr) throw new Error(msg ...
  • Order Food with Mediator.

    Ordering Food using a Waiter as a mediator.

    $(function() {
    var Customer = function(waiter) {
        this.waiter = waiter;   
    };
    
    Customer.prototype = {
        orderMeal: function() {
            this.waiter.orderDrink(this);
            this.waiter.orderBread(this ...
  • Remove item from CollectionHash using Item

    Remove an item directly from a CollectionHash without finding its key.

    var hash = AFrame.CollectionHash.create();
    
    var item = {
        cid: 1,
        fieldName: 'fieldValue'
    };
    
    
    hash.insert( item );
    
    // Remove the item using the cid ...
  • DataForm Example with 2 Views #1 is the latest revision

    DataForm Example with 2 views, 1 input, and one output

    var libraryDataContainer = AFrame.DataContainer( {
        name: 'AFrame',
        version: '0.0.20'
    } );
    
    
    var form = AFrame.DataForm.create( {     
        autosave: true,    
        target: '#inputSet',
        dataSource ...
  • DataForm Example with Autosave #3 is the latest revision

    No save needed when using autosave

    var libraryDataContainer = AFrame.DataContainer( {
        name: 'AFrame',
        version: '0.0.20'
    } );
    
    
    var form = AFrame.DataForm.create( {     
        autosave: true,    
        target: '#nameForm',
        dataSource ...
  • DataForm Example #6 is the latest revision

    Example usage of a data form

    var libraryDataContainer = AFrame.DataContainer( {
        name: 'AFrame',
        version: '0.0.20'
    } );
    
    
    var form = AFrame.DataForm.create( {                                                  
        target: '#nameForm',
        dataSource: libraryDataContainer
    } );
    
    $( '#save ...
  • Smaller version of addy's whitelist test

    https://gist.github.com/1012214

    /*Whitelist version with quick test*/
    function k(q){
        var d = document.createElement("div"),
        p = [ "webkit", "moz", "ms", "O", "" ],
        j = 0 ...
  • P2PU - Show classes with Private Variables

    Shows how to use the module pattern to create private variables with classes.

    var Class = function(super, extensions) {
        // Check if there is a super class, if not,
        // set the extensions to the prototype ...