• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • Tutorials
    • API Docs
  • Community
    • Gallery
    • Blog »
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • YUI 2
    • YUI Compressor
    • YUI Doc »
    • YUI Builder
    • YUI PHP Loader
    • YUI Test
    • YUI Website
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • FAQ
  • Developer FAQ
  • Developer Guide
  • Module Setup

Tag Cloud

lsmith plugin io table node nzakas widget datatable form satyam apipkin ericf model jafl async greghinch solmsted liferay css animation caridy event foxxtrot yql davglass

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Selection (gallery-get-selection) on cdn

    Last Updated: 05/3/11
    + 0 -

    Caridy Patino

    YUI Contributor

    See 11 more by this user.

    Created: 05/1/11
    Last CDN Push: 05/4/11
    Build Tag: gallery-2011.05.04-20-03
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.3.0
    Free for use.

    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.

    • Tags:
    • caridy
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Count the number of paragraphs within the scope of the current selection.

    Code Sample

    <script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2011.05.04-20-03'
    }).use('gallery-get-selection', function(Y) {
     
         Y.getSelection().all('p').size();
     
    });

    Forum Posts

    No forum posts for this module.

    © 2006-2011 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