Jump to content

Module:Navbox: Difference between revisions

370 bytes added ,  8 years ago
navigation div instead of single-cell table wrapper
m>Izkala
(Kill nowikis)
m>Matt Fitzpatrick
(navigation div instead of single-cell table wrapper)
Line 116: Line 116:


     titleCell
     titleCell
        :tag('div')
        :tag('div')
            :addClass(args.titleclass)
            :attr('id', mw.uri.anchorEncode(args.title))
            :css('font-size', '114%')
            :addClass(args.titleclass)
            :wikitext(addNewline(args.title))
            :css('font-size', '114%')
            :wikitext(addNewline(args.title))
end
end


Line 360: Line 361:
     local res = mw.html.create()
     local res = mw.html.create()
     if border == 'none' then
     if border == 'none' then
         res:node(tbl)
         local nav = res:tag('div')
            :attr('role', 'navigation')
            :node(tbl)
        if args.title then
            nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title))
        else
            nav:attr('aria-label', 'Navbox')
        end
     elseif border == 'subgroup' or border == 'child' then
     elseif border == 'subgroup' or border == 'child' then
         -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
         -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
Line 370: Line 378:
             :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
             :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
     else
     else
         res
         local nav = res:tag('div')
            :tag('table')
            :attr('role', 'navigation')
                :addClass('navbox')
            :addClass('navbox')
                :css('border-spacing', 0)
            :cssText(args.bodystyle)
                :cssText(args.bodystyle)
            :cssText(args.style)
                :cssText(args.style)
            :css('padding', '3px')
                :tag('tr')
            :node(tbl)
                    :tag('td')
        if args.title then
                        :css('padding', '2px')
            nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title))
                        :node(tbl)
        else
            nav:attr('aria-label', 'Navbox')
        end
     end
     end


Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.