jQuery Mobile 1.4 已更改
<div data-role="content">...</div>
进入
<div role="main" class="ui-content">...</div>
我现在理解使用类而不是数据角色的目的,但我不明白的是这个角色 =“main”。它是干什么用的?
最佳答案
role
属性是 HTML5 原生的,旨在支持 WAI-ARIA。
见 http://www.w3.org/TR/html5/dom.html#wai-aria和 http://www.w3.org/TR/wai-aria/roles#role_definitions
早期版本中的 jQuery Mobile 只是将具有 data-role="content"属性的元素转换为主要元素 <div role="main">
(相当于 <main>
)并添加了 CSS。所以你得到 <div role="main" class="ui-content">
.
对于具有 data-role="content"的元素,没有其他处理或添加标记。通过弃用 data-role="content"属性并直接使用 ask you to use the right HTML5 (CSS and WAI-ARIA role),jQuery Mobile 将不得不为每个页面做更少的处理。
关于jquery-mobile - jQuery Mobile 1.4 中使用的角色 ="main"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20789121/