問(wèn)題描述
我已閱讀 W3C 的頁(yè)面,但對(duì)我來(lái)說(shuō)仍然很模糊.role
屬性的目的是為了闡明代碼嗎?還是會(huì)被某些瀏覽器或蜘蛛解釋?
I have read W3C's page on this, but it is still vague to me. Is the role
attribute's purpose to clarify the code? Or will it be interpreted by some browsers or spiders?
是否可以使用某些 JavaScript 庫(kù)將其用作 DOM 選擇器(我認(rèn)為由于 id
屬性必須是唯一的,這可以用于識(shí)別頁(yè)面上的多個(gè)資源)?
Can it be used as a DOM selector using some JavaScript libraries (I am thinking so since the id
attribute has to be unique, this could be used to identify multiple resources on a page)?
推薦答案
簡(jiǎn)短版:
角色屬性可能會(huì)為未來(lái)的瀏覽器提供一種以獨(dú)立于設(shè)備的方式智能處理某些 XML 元素的方法.例如,在桌面和手持環(huán)境中的瀏覽器上都可以對(duì)標(biāo)有導(dǎo)航"角色屬性的無(wú)序列表進(jìn)行智能解釋?zhuān)蛊湓趦煞N環(huán)境中都能清晰顯示.
The Role Attribute may give future browsers a way to work intelligently with certain XML elements in a device-independent way. For example, an unordered list that is marked with the role attribute of "navigation" can be interpreted intelligently on browsers in both desktop and handheld environments, allowing it to be displayed clearly in both environments.
加長(zhǎng)版:
本規(guī)范中定義的 XHTML 角色屬性允許作者使用機(jī)器可提取的有關(guān)元素用途的語(yǔ)義信息來(lái)注釋 XML 語(yǔ)言.用例包括可訪問(wèn)性、設(shè)備適配、服務(wù)器端處理和復(fù)雜數(shù)據(jù)描述.
The XHTML Role Attribute defined in this specification allows the author to annotate XML Languages with machine-extractable semantic information about the purpose of an element. Use cases include accessibility, device adaptation, server-side processing, and complex data description.
該屬性描述了當(dāng)前元素在文檔上下文中所扮演的角色.例如,應(yīng)用程序和輔助技術(shù)可以使用它來(lái)確定元素的用途.這可以允許用戶(hù)做出明智的決定,決定可以對(duì)元素采取哪些操作,并以設(shè)備獨(dú)立方式激活所選操作.它還可以用作以領(lǐng)域特定方式(例如,法律術(shù)語(yǔ)分類(lèi)法)注釋文檔部分的機(jī)制.
The attribute describes the role(s) the current element plays in the context of the document. This can be used, for example, by applications and assistive technologies to determine the purpose of an element. This could allow a user to make informed decisions on which actions may be taken on an element and activate the selected action in a device independent way. It could also be used as a mechanism for annotating portions of a document in a domain specific way (e.g., a legal term taxonomy).
例子:
<ul role="navigation sitemap">
<li href="downloads">Downloads</li>
<li href="docs">Documentation</li>
<li href="news">News</li>
</ul>
鑒于 XHTML2 工作組將在今年年底不復(fù)存在,因此該規(guī)范不可能以類(lèi)似于其當(dāng)前形式的任何形式達(dá)到發(fā)布狀態(tài).http://www.w3.org/News/2009#entry-6601
Given that the XHTML2 Working Group will cease to exist at the end of this year, there's no chance of this specification ever reaching release status in anything resembling its current form. http://www.w3.org/News/2009#entry-6601
這篇關(guān)于什么是 XHTML 角色屬性?你用它來(lái)做什么?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!