Rangy True Cross-browser Serializer

Created: September 26, 2013
Last Modified: June 12, 2018
((( spellific )))
Practice spelling while playing a fun word game!
Click here to play
Speech Recognition Anywhere
  • Type emails with your voice
  • Write documents with your voice
  • Control the Internet with your voice
  • Chrome Extension
Reconocimiento de voz en cualquier lugar
  • Escribe correos electrónicos con tu voz
  • Escribe documentos con tu voz
  • Controla la Internet con tu voz
  • Extensión de Chrome
Spracherkennung Allerorts
  • Geben Sie E-Mails mit Ihrer Stimme ein
  • Schreiben Sie Dokumente mit Ihrer Stimme
  • Steuern Sie das Internet mit Ihrer Stimme
  • Chrome-Erweiterung
Reconnaissance de la parole
  • Tapez des e-mails avec votre voix
  • Écrivez des documents avec votre voix
  • Contrôlez l'Inernet avec votre voix
  • Extension Chrome
Riconoscimento vocale ovunque
  • Digita e-mail con la tua voce
  • Scrivi documenti con la tua voce
  • Controlla Internet con la tua voce
  • Estensione Chrome
どこでも
音声認識
  • あなたの声で文書を書く
  • あなたの声でメールを入力してください
  • 音声でインターネットをコントロール
  • Chrome拡張機能
语音识别
无处不在
  • 用你的声音写文件
  • 用您的声音输入电子邮件
  • 用你的声音控制互联网
  • Chrome 扩展程序
語音識別
無處不在
  • 用你的聲音寫文件
  • 用您的聲音輸入電子郵件
  • 用你的聲音控制互聯網
  • Chrome 擴展程序
Subscribe to Internet Tips and Tools Feed
f Share
-
G+ Share
-
Tweet
-
in Share
-
P in it
-

I have created serialize/deserialize functions for Rangy that gives the same serialization between IE <= 8, IE 9, Webkit (Chrome, Safari, iPhone) and Firefox. It seems to work in the testing I have done. The two functions have comments explaining what they do. You can serialize a range in IE and it should be able to deserialize in Chrome, etc. It has worked so far in multiple pages that I have tested.

The functions count through all elements on the page or in the rootNode provided and skips the elements that are not compatible between the browsers or that have an emtpy innerHTML. The incompatible elements are title tags and comment tags and some tags with empty innerHTML.

The serialized range that is returned is seperated by commas and contains this data: startCharacter, endCharacter, startElement, endElement, startTextNode, endTextNode. So 0,26,333,333,0,0 would be the 0th or 1st character hightlighted to the 26th character highlighted, in the 333 HTML element (not counting incompatible elements) starting and ending in the first text node in the element (or text node 0). dlc_b

Download

Downloaded 0 times.
Please make a donation to reveal the download link.

Use as follows:

cb_serializeRange(Range range[,Element rootNode])

For example:

	selection = rangy.getSelection(); 
	if(selection.rangeCount > 0) 
		range = selection.getRangeAt(0);
	var serial = cb_serializeRange(range, document.getElementById('container'));

will return a serial of the range starting from the 'container' element.

cb_deserializeRange(String cb_serializedRange[, Element rootNode])

For example:

	
	range = cb_deserializeRange("0,26,333,333,0,0", document.getElementById('container'))

will return a rangy range based on the serial provided starting from the 'container' element.
((( spellific )))
Practice spelling while playing a fun word game!
Click here to play
Speech Recognition Anywhere
  • Type emails with your voice
  • Write documents with your voice
  • Control the Internet with your voice
  • Chrome Extension
Reconocimiento de voz en cualquier lugar
  • Escribe correos electrónicos con tu voz
  • Escribe documentos con tu voz
  • Controla la Internet con tu voz
  • Extensión de Chrome
Spracherkennung Allerorts
  • Geben Sie E-Mails mit Ihrer Stimme ein
  • Schreiben Sie Dokumente mit Ihrer Stimme
  • Steuern Sie das Internet mit Ihrer Stimme
  • Chrome-Erweiterung
Reconnaissance de la parole
  • Tapez des e-mails avec votre voix
  • Écrivez des documents avec votre voix
  • Contrôlez l'Inernet avec votre voix
  • Extension Chrome
Riconoscimento vocale ovunque
  • Digita e-mail con la tua voce
  • Scrivi documenti con la tua voce
  • Controlla Internet con la tua voce
  • Estensione Chrome
どこでも
音声認識
  • あなたの声で文書を書く
  • あなたの声でメールを入力してください
  • 音声でインターネットをコントロール
  • Chrome拡張機能
语音识别
无处不在
  • 用你的声音写文件
  • 用您的声音输入电子邮件
  • 用你的声音控制互联网
  • Chrome 扩展程序
語音識別
無處不在
  • 用你的聲音寫文件
  • 用您的聲音輸入電子郵件
  • 用你的聲音控制互聯網
  • Chrome 擴展程序
Back to www.seabreezecomputers.com
Subscribe to Internet Tips and Tools Feed        

User Comments

There are 1 comments.

Displaying first 50 comments.

1. Posted By: Alejandro Micheloud - - January 12, 2014, 3:28 am
Thanks, works great in almost browsers. Have a problem with FF 26 but i'm finding a solution.