Caridy Patino![]()
Getting a DOM fragment with the current selection. It returns a DOM Fragment with a copy of the dom structure selected.
/* get the number of paragraphs within the scope of the current selection */
Y.getSelection().all('p').size();
Note: All the credit for Dav Glass (@davglass), since he has provided the whole chunk of code, I just did the monkey work.
Count the number of paragraphs within the scope of the current selection.
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2012.10.17-20-00'
}).use('gallery-get-selection', function(Y) {
Y.getSelection().all('p').size();
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info