为什么存在像Facebook FBML或Google G这样的标记语言?

发布于 2024-12-04 05:36:51 字数 829 浏览 6 评论 0 原文

我苦苦思索了很久,想不出html、css、javascript和iframe解决不了的问题。

有人可以阐明 FBML 和 google g 标记语言存在背后的推理吗?它们如何以及使什么变得更容易?

g:plusone示例(例如添加“like”按钮时使用的代码):

<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="tall"></g:plusone>

或facebook fbml示例-(例如添加facebook“like”按钮时使用的代码):

<fb:like send="false" layout="box_count" width="450" show_faces="true" action="recommend" font="verdana"></fb:like>

<html xmlns:fb="https://www.facebook.com/2008/fbml">

查看上面的示例- 我们不能简单地将

<g and <fb 

元素替换为具有 facebookplusone 类的 div 吗?

PS 不确定 g 是否是一种语言 - 至少我在谷歌搜索时找不到任何关于它的信息。当他们使用像 g 或 c 这样的单字符名称时真的很糟糕。

I thought long and hard and can't think of problems that cannot be solved by html, css, javascript and iframes.

Can somebody shed some light on reasoning's behind FBML and google g markup languages existance. How and what do they make easier?

g: plusone example (code used when adding like button for example):

<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="tall"></g:plusone>

or facebook fbml example - ( code used when adding facebook like button for example):

<fb:like send="false" layout="box_count" width="450" show_faces="true" action="recommend" font="verdana"></fb:like>

<html xmlns:fb="https://www.facebook.com/2008/fbml">

Looking on example above - can't we simply replace

<g and <fb 

elements with divs that have facebook or plusone class for example?

P.S. not sure if g is a language - at least I couln't find anything about it while googling. Really sucks when they use these single character names like g or c.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡水深流 2024-12-11 05:36:51

这可能是为了避免命名空间问题。

如果您使用 DIV 实现此目的,则必须 100% 确保您选择的类名是唯一的,以便它不会与用户的类冲突。例如

就不是一个好名字,因为如果用户将此代码包装到自己的容器中并将其命名为“google-plusone”(并非不可能)会怎样? ?

因此 Google 必须想出丑陋的类名,如“google----plusone”等。指定一个新的 XML 命名空间并将其代码放入其中要优雅得多。

It's probably to avoid namespacing issues.

If you implement this with a DIV you have to make 100% sure that the classname you choose is unique, so that it doesn't conflict with the user's classes. For example <div class="google-plusone" would not be a good name because what if the user wrapped this code into his own container and named it "google-plusone" too (not unlikely)?

So Google would have to come up with ugly class names like "google----plusone", etc. It's much more elegant to specify a new XML namespace and put their code inside.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文