定义我自己的新属性?

编程入门 行业动态 更新时间:2024-10-26 16:29:21
本文介绍了定义我自己的新属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在一些XHTML元素上定义其他属性。 的目的是将它们用作脚本的参数。到目前为止,我还没有很好地掌握如何*干净地添加属性*。当然,我可以把它们放进去,就像这样, < input type =" text" myns名字:MAXLENGTH = QUOT; 10" /> 但是,这不是有效的XHTML。如果可能的话,我想要实现的目标是这样的:我希望与XHTML验证器和平相处,告诉他们 他们应该将XHTML检查为他们知道这一点,当他们看到一个带有特定前缀的属性时,他们不应该抱怨它有关它的信息,而是接受我的业务是照顾 属性。 Michael - Michael Schuerig Airtight论证有/> mailto:mi ***** @ schuerig.de空洞的结论。 www.schuerig.de/michael/ - 啊罗蒂,解释情绪

解决方案 迈克尔Schuerig写道:我想以限定一些额外的属性XHTML元素。目的是将它们用作脚本的参数。到目前为止,我还没有很好地掌握如何*干净地添加属性*。当然,我可以把它们放进去,就像这样, < input type =" text" myns名字:MAXLENGTH = QUOT; 10" /> 但是,这不是有效的XHTML。如果可能的话,我想要实现的目标是:我希望与XHTML验证员和睦相处,告诉他们他们应该只是检查他们所知道的XHTML以及他们什么时候遇到一个具有特定前缀的属性,他们不应该抱怨它,而是接受我的业务来照顾属性。

如果你提供这样的页面,你就不能这样做。将它们作为XML服务而不是 (x)html。 但是,如果你在网上为它们服务,你可以处理它。 /> 通过与用户代理协商。删除你的额外属性 (使用Apache命名空间框架,或你的服务器的等价物) 服务于''正常''客户端。让想要你的 命名空间的客户在Accept:标题中说出来,并根据它进行协商。 - 尼克基尤 尼克基尤写道: 迈克尔Schuerig写道:我想限定某些XHTML元素的附加属性。目的是将它们用作脚本的参数。到目前为止,我还没有很好地掌握如何*干净地添加属性*。当然,我可以把它们放进去,就像这样, < input type =" text" myns名字:MAXLENGTH = QUOT; 10" /> 但是,这不是有效的XHTML。如果可能的话,我想要实现的目标是:我希望与XHTML验证器和平相处,告诉他们他们应该只检查XHTML,因为他们知道它和/或当他们遇到具有特定前缀的属性时,他们不应该抱怨它,而是接受这是我的业务来照顾属性。你不能服务这样的页面。将它们作为XML服务而不是(x)html。

究竟是什么意思不能?以这种方式无法实现有效的XHTML?或者浏览器无法处理 他们得到了什么? 但是,如果你在网上提供它们,你可以处理它通过与用户代理协商。删除您的额外属性(使用Apache命名空间框架,或您的服务器等效)服务于正常客户端时。让想要你的命名空间的客户在Accept:标题中说出来,并根据它进行协商。

我的客户端是普通的当前Web浏览器。理想情况下,他们只是忽略了他们不知道的属性。我会用JavaScript处理它们。 Michael - Michael Schuerig思考正试图化妆 mailto:mi ***** @ schuerig.de在一个人的教育中存在差距。 www.schuerig.de/michael/ - 吉尔伯特莱尔

在物品<德********** @ newsreader3cologne.de>中 迈克尔Schuerig< MI ***** @ schuerig.de>写道:

如果你提供这样的页面,你就不能这样做。将它们作为XML服务而不是(x)html。你究竟是什么意思不能?以这种方式无法实现有效的XHTML?

如果根据XHTML 1.0,XHTML 1.1或 XHTML Basic,你的文件显然不是有效的XHTML 1.0,XHTML 1.1 或XHTML Basic。 但是,如果您编写自己的架构,则根据该架构,您的文档可以有效 。您可能如实声称您的 语言属于XHTML系列。 或者浏览器无法处理他们得到了什么?

他们将通过将属性解析为DOM并且不对任何特定的 属性进行处理来处理方式。 - Henri Sivonen hs******@iki.fi http:// hsivonen.iki.fi/ Mozilla的Web创作常见问题: mozilla/docs/web-developer/faq.html

I would like to define additional attributes on some XHTML elements. The purpose is to use them as parameters for scripts. So far, I have no good grasp on how to add attributes *cleanly*. Of course, I can just put them in, like this, <input type="text" myns:maxlength="10" /> However, that''s not valid XHTML. If possible, what I''d like to achieve is this: I want to live in peace with XHTML validators by telling them that they should just check the XHTML as they know it and when they encounter an attribute with a specific prefix they should not complain about it, but instead accepts that it is my business to look after the attribute. Michael -- Michael Schuerig Airtight arguments have mailto:mi*****@schuerig.de vacuous conclusions. www.schuerig.de/michael/ --A.O. Rorty, Explaining Emotions

解决方案

Michael Schuerig wrote:

I would like to define additional attributes on some XHTML elements. The purpose is to use them as parameters for scripts. So far, I have no good grasp on how to add attributes *cleanly*. Of course, I can just put them in, like this, <input type="text" myns:maxlength="10" /> However, that''s not valid XHTML. If possible, what I''d like to achieve is this: I want to live in peace with XHTML validators by telling them that they should just check the XHTML as they know it and when they encounter an attribute with a specific prefix they should not complain about it, but instead accepts that it is my business to look after the attribute.

You can''t if you serve up pages like that. Serve them as XML rather (x)html. However, if you''re serving them on the Web, you can deal with it by negotiating with user agents. Strip out your extra attributes (using the Apache namespace framework, or your server''s equivalent) when serving to a ''normal'' client. Have clients that want your namespace say so in an Accept: header, and negotiate based on that. -- Nick Kew

Nick Kew wrote:

Michael Schuerig wrote:

I would like to define additional attributes on some XHTML elements. The purpose is to use them as parameters for scripts. So far, I have no good grasp on how to add attributes *cleanly*. Of course, I can just put them in, like this, <input type="text" myns:maxlength="10" /> However, that''s not valid XHTML. If possible, what I''d like to achieve is this: I want to live in peace with XHTML validators by telling them that they should just check the XHTML as they know it and when they encounter an attribute with a specific prefix they should not complain about it, but instead accepts that it is my business to look after the attribute. You can''t if you serve up pages like that. Serve them as XML rather (x)html.

What exactly do you mean by "can''t"? That it is not possible to achieve valid XHTML in this way? Or that browsers won''t be able to deal with what they get? However, if you''re serving them on the Web, you can deal with it by negotiating with user agents. Strip out your extra attributes (using the Apache namespace framework, or your server''s equivalent) when serving to a ''normal'' client. Have clients that want your namespace say so in an Accept: header, and negotiate based on that.

My clients are ordinary current web browsers. Ideally they just ignore attributes they don''t know about. I''ll handle them with JavaScript. Michael -- Michael Schuerig Thinking is trying to make up mailto:mi*****@schuerig.de for a gap in one''s education. www.schuerig.de/michael/ --Gilbert Ryle

In article <de**********@newsreader3cologne.de>, Michael Schuerig <mi*****@schuerig.de> wrote:

You can''t if you serve up pages like that. Serve them as XML rather (x)html. What exactly do you mean by "can''t"? That it is not possible to achieve valid XHTML in this way?

If you add stuff that is not valid according to XHTML 1.0, XHTML 1.1 or XHTML Basic, your document obviously won''t be valid XHTML 1.0, XHTML 1.1 or XHTML Basic. However, if you write your own schema, your document can be valid according to that schema. You may be able to truthfully claim that your language belongs in the "XHTML family". Or that browsers won''t be able to deal with what they get?

They''ll deal by parsing the attribute into the DOM and not acting on the attribute in any particular way. -- Henri Sivonen hs******@iki.fi hsivonen.iki.fi/ Mozilla Web Author FAQ: mozilla/docs/web-developer/faq.html

更多推荐

定义我自己的新属性?

本文发布于:2023-10-29 07:43:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539119.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自己的   属性   定义

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!