mozilla
Your Search Results

    Template:csspercentageshorthand

    <%
    // $0 is the name of the definition (property or data type), without < > or ''
    // $1 is a string containing the list of the associated longhand properties
    
    // Read the word of the parameters one by one and store them in an array
    var values = $1.split(" ");  // Array
    
    // Load the whole page (wiki.page does cache the original page
    var page = wiki.page(mdn.localString({
        "en-US": "en-US/docs/Web/CSS/CSS_percentage_values",
        "fr"   : "fr/docs/CSS/CSS_percentage_values"
    }));
    
    var s_str = mdn.localString({
        "en-US": "The values of its longhand properties the percentage value belongs to:",
        "fr"   : "les valeurs de ses propriétés auxquelles se rapportent les pourcentages:"
    });
    var s_isshorthand  = mdn.localString({
        "en-US": "is itself a shorthand, its initial value is the concatenation of its own longhand properties"
    });
    
    var s_result = s_str + '<ul>';
    var s_desc = "";
    
    for (var i = 0; i < values.length; i++) {
        var re = new RegExp("<\\s*(span|div)\\s+id\\s*=\\s*"+'"percentage-'+values[i]+'"'+"[^>]*>(.*)<\\s*/\\s*(span|div)\\s*\\>","igm");
        var prop = re.exec(page);
    
        if (prop) {
            s_desc = prop[2];
        } else {    // If not found, it is a shorthand itself
            s_desc = s_isshorthand;
        }
    
        s_result += '<li><code>' + values[i] + '</code>: ' + s_desc +'</li>';
    }
    s_result += '</ul>';
    
    var result = '<span id="percentage-' + $0 + '">' + s_result + '</span>';
    
    %><%- result %>
    Search for pages that use Template:csspercentageshorthand to see example use cases and how many pages use this macro.

    Document Tags and Contributors

    Contributors to this page: ethertank, Marsf, teoli
    Last updated by: ethertank,