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

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

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.

    Intl Bidi (gallery-intl-bidi) on cdn

    Last Updated: 09/28/10
    + 1 -

    Roozbeh Pournader

    YUI Contributor

    See 2 more by this user.

    Created: 06/10/10
    Last CDN Push: 09/29/10
    Build Tag: gallery-2010.09.29-18-36
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.2.0
    Free for use.

    This module provides the part of the Unicode Bidirectional Algorithm missing in browsers.

    While the HTML standard requires the direction of every element to be specified or inherited, there are numerous times that a text string is entered by a user or received from a third party with no specified direction.

    This module provides a method (Y.Intl.detectDirection) to detect the direction of a string according to the steps P1..P3 of the Unicode Bidirectional Algorithm.

    The latest version supports the full range of Unicode 5.2 characters, including non-BMP characters.

    Note: an older version of the module provided a method called bidiDirection. Although that method is still available for backward compatibility as an alias, please convert your code to use detectDirection.

    • Tags:
    • roozbeh bidi intl-bidi intl
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Code Sample

    <script src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2010.09.29-18-36'
    }).use('gallery-intl-bidi', function(Y) {
        // returns "ltr", since the first letter in the string is a "T", which is LTR.
        alert(Y.Intl.detectDirection("The first letter of the Hebrew alphabet is \u05D0."));
     
        // returns "rtl", since the first letter is a Hebrew Alef, which is RTL.
        alert(Y.Intl.detectDirection("----\u05D0----"));
     
        // returns "" (for neutral), since the string contains no letters.
        alert(Y.Intl.detectDirection("--------"));
     
        // returns "ltr", as that is specified as the fallback return value for neutral strings.
        alert(Y.Intl.detectDirection("--------", "ltr"));
     
        // returns "rtl", as that is specified as the fallback return value for neutral strings.
        alert(Y.Intl.detectDirection("--------", "rtl"));
     
        // returns "rtl", as although the fallback is specified to be LTR, the string is not neutral.
        alert(Y.Intl.detectDirection("----\u05D0----", "ltr"));
    });

    © 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