mozilla
Your Search Results

    Template:htmlattrxref

    <%
    // Inserts a link to the specified attribute of a particular HTML element.
    //
    // Parameters:
    //  $0  The attribute to insert
    //  $1  The element on which the attribute is used (optional)
    //  $2  The text to display (between code)
    //
    // If the element isn't specified, the link is made to the Global Attributes
    // page.
    
    var lang = env.locale;
    var url = "";
    
    $0 = $0.toLowerCase();
    
    var text = ($2 && ($2!=undefined))?$2:$0;
    
    if ($1 && ($1 != undefined)) {
        url = '/' + lang + '/docs/Web/HTML/Element/' + $1;
    } else {
        url = '/' + lang + '/docs/Web/HTML/Global_attributes';
    }
    var result = '<code><a href="' + url + '#attr-' + $0 +'">' + text + '</a></code>';
    %>
    <%- result %>
    Search for pages that use Template:htmlattrxref to see example use cases and how many pages use this macro.

    Document Tags and Contributors

    Tags: 
    Contributors to this page: Sheppy, lmorchard, LucianU, teoli
    Last updated by: teoli,