简体   繁体   English

JavaScript选择/范围框架

[英]JavaScript selection/range framework

我一直在使用选择/范围对象,并且由于浏览器之间对于特定选择/范围内容(甚至超过DOM)的大量不一致,我想知道是否有一个框架可以帮助我完成它们。

I've written a new range/selection library called Rangy that is similar in concept to IERange but goes quite a lot further. 我写了一个名为Rangy的新范围/选择库,它在概念上与IERange类似,但是进一步发展。 The core is pretty much complete and currently available to download . 核心非常完整, 目前可供下载 I'm currently bugfixing and documenting it and it should be only be a few weeks before a full release. 我目前正在修复和记录它,它应该只是在完整版本发布前几周。

UPDATE 31 August 2011 更新2011年8月31日

Rangy is now stable and at version 1.2 ( downloads page ). Rangy现在稳定,版本为1.2( 下载页面 )。

(Made an answer by request ;) (根据要求作出答复;)

Take a look at IERange : 看看IERange

IERange is a feature-complete implementation of W3C DOM Ranges for Internet Explorer, allowing users to write one cross-browser version of their range manipulation code. IERange是用于Internet Explorer的W3C DOM范围的功能完整实现,允许用户编写其范围操作代码的一个跨浏览器版本。

Supports Range APIs: 支持范围API:

  • document.createRange()
  • startContainer , startOffset , endContainer , endOffset , commonAncestorContainer , collapsed startContainerstartOffsetendContainerendOffsetcommonAncestorContainercollapsed
  • setStart() , setEnd() , setStartBefore() , setStartAfter() , setEndBefore() , setEndAfter() , selectNode() , selectNodeContents() , collapse() setStart()setEnd()setStartBefore()setStartAfter()setEndBefore()setEndAfter()selectNode()selectNodeContents()collapse()
  • insertNode() , surroundContents() insertNode()surroundContents()
  • extractContents() , cloneContents() , deleteContents() extractContents()cloneContents()deleteContents()
  • compareBoundaryPoints() , cloneRange() , createContextualFragment() , toString() compareBoundaryPoints()cloneRange()createContextualFragment()toString()

Supports Selection APIs: 支持选择API:

  • Range support (Webkit-style) 范围支持(Webkit风格)
  • window.getSelection()
  • addRange() , removeAllRanges() , getRangeAt() , toString() addRange()removeAllRanges()getRangeAt()toString()

fieldselection是一个非常实用的jquery插件,用于选择/范围操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM