You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What about provide an API wrapper for the selection object? For example, provide the size of the selected area, and other things that is possible to do using this API getSelection, Selection and Range
Also, this fokus plugin use this getSelection API, we can learn something from his code and learn more about this getSelection object, and turn selecting a lib to help people work with text selection in some way.
varselection=selecting('.selector-to-watch');// otherwise watch in all document/window// Fired when the user start selecting somethingselection.on('selectionStart',function(text,selectionObject){});// Fired when the selected text is changedselection.on('selectionChange',function(newText,oldText,selectionObject){});// Fired when the user remove the selection of text, return the selected text before the user remove the text selectionselection.on('selectionEnd',function(oldText,selectionObject){});/* We can do something to the developer just play around with getSelection object if available*/selection.hasSelection();// return true or falseselection.runif(function(api){// `api` is the getSelection objet + some useful shortcut functions included by selecting// This function is only executed if there's some active text selection });
getSelection is supported by most of browsers, including smartTVs and consoles, just IE7,8, for these we can turn selection in a kind of basic polyfill to normalize something (but I don't think that is useful spend much time wondering about old browsers)
The text was updated successfully, but these errors were encountered:
What about provide an API wrapper for the selection object? For example, provide the size of the selected area, and other things that is possible to do using this API getSelection, Selection and Range
Also, this fokus plugin use this getSelection API, we can learn something from his code and learn more about this getSelection object, and turn
selecting
a lib to help people work with text selection in some way.getSelection
is supported by most of browsers, including smartTVs and consoles, just IE7,8, for these we can turn selection in a kind of basic polyfill to normalize something (but I don't think that is useful spend much time wondering about old browsers)The text was updated successfully, but these errors were encountered: