JSFiddle

  • Autoscroll #3 is the latest revision

    jQuery 1.6.2, HTML, CSS, JavaScript

    function getScrollbarWidth() {
        var $div = $('<div />').css({
            width: 100,
            height: 100,
            overflow: 'auto',
            position: 'absolute',
            top: -1000,
            left: -1000
        }).prependTo('body').append ...
  • Testing Caret Position - Resolved #47 is the latest revision

    Comparing the reported caret position in IE versus a Gecko-based browser.

    function getCaretPosGecko(txtbox) {
        return txtbox.selectionStart;
    }
    
    function getCaretPosIE(txtbox) {
        var caret, normalizedValue, range, textInputRange, len, endRange;
    
        txtbox.focus();
        range = document ...
  • Testing Caret Position #59 is the latest revision

    Comparing the reported caret position in IE versus a Gecko-based browser.

    function getCaretPosGecko(txtbox) {
        return txtbox.selectionStart;
    }
    
    function getCaretPosIE(txtbox) {
        var range, rangeCopy;
    
        txtbox.focus();
        range = document.selection.createRange();
    
        if (range ...
  • Testing Global RegExp Example

    Mootools 1.3.2, HTML, CSS, JavaScript

    function testRegex(pattern, array) {
        document.writeln('Pattern = ' + pattern + ', Array = ' + array + '<br/>');
        for (var ii = 0; ii < array.length; ii++) {
            document.writeln(ii + ', ');
            document.writeln(array[ii] + ', ');
            document.writeln(pattern.test(array[ii]) + '<br />');
            
            // This line is crucial for ...</br/>
  • Interpolated Textbox

    jQuery 1.6.2, HTML, CSS, JavaScript

    // Reporting Utilities
    var rptStack = [];
    
    function beginReport(funcName) {
        rptStack.unshift(funcName);
    }
    
    function endReport() {
        rptStack.shift();
    }
    
    function report(key, value) {
        if (!$('#disableRpt ...
  • Regex Testing

    jQuery (edge), HTML, CSS, JavaScript

    var midPatt = /\{\{[^}]*\}?$/;
    var midCases = [
        /*  1 */ '{{',
        /*  2 */ '{{}}',
        /*  3 */ ' {{ }} ',
        /*  4 */ '{{ }} ',
        /*  5 */ ' {{ }}',
        /*  6 */ 'a{{b}}c',
        /*  7 */ '{{a}}b',
        /*  8 */ 'a{{b}}',
        /*  9 ...
  • Delay #123 is the latest revision

    jQuery 1.6, HTML, CSS, JavaScript

    function changeOrder(newOrder) {
        var $divs = $('div'),
            $parent = $divs.eq(0).parent();
        for (var ii = 0; ii < newOrder.length; ii++) {
            $parent ...