在 Mozilla Firefox 中使用 javascript 查找正文中的元标记
如何在 Mozilla Firefox 的正文部分找到元标记?
示例:
<!DOCTYPE html>
<head profile="http://microformats.org/profile/hcalendar"></head>
<body>
<div itemscope itemtype="http://data-vocabulary.org/Event">
<a href="http://www.example.com/events/spinaltap" itemprop="url" ><span itemprop="summary">Spinal Tap</span></a>
<img itemprop="photo" src="spinal_tap.jpg" />
<span itemprop="description">After their highly-publicized search for a new drummer,Spinal Tap kicks off their latest comeback tour with a SanFrancisco show.</span>
When:
<time itemprop="startDate" datetime="2015-10-15T19:00-08:00">Oct 15, 7:00PM</time>—
<time itemprop="endDate" datetime="2015-10-15T19:00-08:00">Oct 15, 9:00PM</time>
Where:
<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/?Organization">
<span itemprop="name">Warfield Theatre</span>
<span itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address">
<span itemprop="street-address">982 Market St</span>,
<span itemprop="locality">San Francisco</span>,
<span itemprop="region">CA</span>
</span>
<span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/?Geo">
<meta itemprop="latitude" content="35.774929"/>
<meta itemprop="longitude" content="-122.419416"/>
</span>
</span>
Category: <span itemprop="eventType">Concert</span>
</div>
</body>
</html>
Firefox 似乎正在将元标记移动到头部,使它们作为 itemprop="geo" 的子元素无法访问。有没有比通过标签名称获取 lat/lng 元标签然后将它们与 itemtype="Event" 一起拼图更好的方法?
How do i find metatags in the body section in Mozilla Firefox?
Example:
<!DOCTYPE html>
<head profile="http://microformats.org/profile/hcalendar"></head>
<body>
<div itemscope itemtype="http://data-vocabulary.org/Event">
<a href="http://www.example.com/events/spinaltap" itemprop="url" ><span itemprop="summary">Spinal Tap</span></a>
<img itemprop="photo" src="spinal_tap.jpg" />
<span itemprop="description">After their highly-publicized search for a new drummer,Spinal Tap kicks off their latest comeback tour with a SanFrancisco show.</span>
When:
<time itemprop="startDate" datetime="2015-10-15T19:00-08:00">Oct 15, 7:00PM</time>—
<time itemprop="endDate" datetime="2015-10-15T19:00-08:00">Oct 15, 9:00PM</time>
Where:
<span itemprop="location" itemscope itemtype="http://data-vocabulary.org/?Organization">
<span itemprop="name">Warfield Theatre</span>
<span itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address">
<span itemprop="street-address">982 Market St</span>,
<span itemprop="locality">San Francisco</span>,
<span itemprop="region">CA</span>
</span>
<span itemprop="geo" itemscope itemtype="http://data-vocabulary.org/?Geo">
<meta itemprop="latitude" content="35.774929"/>
<meta itemprop="longitude" content="-122.419416"/>
</span>
</span>
Category: <span itemprop="eventType">Concert</span>
</div>
</body>
</html>
It seems like firefox is moving the meta tags to the head making them unreachable as a child element of itemprop="geo". Is there a better way than getting the lat/lng meta tags by tag name and then puzzle them together with the itemtype="Event"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我阅读 Bug 591467“实现 HTML 微数据 API” 和 Firefox 16.0 的发行说明 从 Firefox 16 开始应该支持此功能。
If I read Bug 591467 "Implement HTML Microdata API" and the release notes of Firefox 16.0 this should be supported as of Firefox 16.