MVC框架 - 服务器端DOM操作

时间:2022-11-22 20:02:12

I'm building an MVC framework, and I'm looking for native solutions / frameworks / tag libraries to draw from or to replace my framework entirely.

我正在构建一个MVC框架,我正在寻找原生的解决方案/框架/标签库来完全取代或替换我的框架。

I'm interested in the following features specifically:

我特别感兴趣的是以下功能:

  • server-side DOM manipulation
  • 服务器端DOM操作

  • server-side events (page reload, form submit, node insertion, etc.)
  • 服务器端事件(页面重新加载,表单提交,节点插入等)

  • traversing the DOM tree using css selectors
  • 使用css选择器遍历DOM树

  • validation of html nodes nesting
  • 验证html节点嵌套

  • validation of html nodes allowed attributes
  • 验证html节点允许的属性

  • support for tag libraries / user controls
  • 支持标记库/用户控件

Pretty much what you get with JavaScript, but on the server-side and with some little extras.

几乎是你用JavaScript获得的,但在服务器端和一些额外的东西。

Any solution will do (even if partial), any language will do, any pointers are appreaciated (even from client-side languages, as long as it's possible to check the source code). Dealing with malformed html is not a prerequisite. Outputting valid markup is a big plus.

任何解决方案都会做(即使是部分),任何语言都会做,任何指针都是适用的(即使是从客户端语言,只要可以检查源代码)。处理格式错误的HTML不是先决条件。输出有效标记是一大优点。


Please offer practical solutions by pointing the language/framework that is being discussed and, if possible, what features it provides.

请提供实用的解决方案,指出正在讨论的语言/框架,如果可能,请提供它提供的功能。

6 个解决方案

#1


If you load your page into a DOM-parser you would be able to modify it from there. Then outputting it to the output buffer seems trivial.

如果您将页面加载到DOM解析器中,您可以从那里修改它。然后将它输出到输出缓冲区似乎微不足道。

But you would need to store the entire document in memory, which will inflict on the performance.

但是您需要将整个文档存储在内存中,这会对性能造成影响。

#2


have you checked out aptana jaxer?

你检查了aptana jaxer吗?

#3


So, jQuery has a sort of selectors API implemented, I guess I can take a look at their source code. Also, PHP has support for XPath, this could help too.

所以,jQuery有一种实现的选择器API,我想我可以看看他们的源代码。此外,PHP支持XPath,这也可能有所帮助。

#4


Found a php html dom parser that also implements some html selectors here: http://simplehtmldom.sourceforge.net

找到一个php html dom解析器,它也在这里实现了一些html选择器:http://simplehtmldom.sourceforge.net

#5


Fizzler uses HTMLAgility pack and adds a server side queryselectorall to provide css selection: http://code.google.com/p/fizzler/

Fizzler使用HTMLAgility包并添加服务器端queryselectorall以提供css选择:http://code.google.com/p/fizzler/

#6


Maybe you are looking for ItsNat

也许你正在寻找ItsNat

#1


If you load your page into a DOM-parser you would be able to modify it from there. Then outputting it to the output buffer seems trivial.

如果您将页面加载到DOM解析器中,您可以从那里修改它。然后将它输出到输出缓冲区似乎微不足道。

But you would need to store the entire document in memory, which will inflict on the performance.

但是您需要将整个文档存储在内存中,这会对性能造成影响。

#2


have you checked out aptana jaxer?

你检查了aptana jaxer吗?

#3


So, jQuery has a sort of selectors API implemented, I guess I can take a look at their source code. Also, PHP has support for XPath, this could help too.

所以,jQuery有一种实现的选择器API,我想我可以看看他们的源代码。此外,PHP支持XPath,这也可能有所帮助。

#4


Found a php html dom parser that also implements some html selectors here: http://simplehtmldom.sourceforge.net

找到一个php html dom解析器,它也在这里实现了一些html选择器:http://simplehtmldom.sourceforge.net

#5


Fizzler uses HTMLAgility pack and adds a server side queryselectorall to provide css selection: http://code.google.com/p/fizzler/

Fizzler使用HTMLAgility包并添加服务器端queryselectorall以提供css选择:http://code.google.com/p/fizzler/

#6


Maybe you are looking for ItsNat

也许你正在寻找ItsNat