[TemporaryStorage] add files required for SDK build
[samples/web/TemporaryStorage.git] / tizen-web-ui-fw / latest / js / src / jquery.mobile.widget.js
1 (function( $, undefined ) {
2
3 $.widget( "mobile.widget", {
4         // decorate the parent _createWidget to trigger `widgetinit` for users
5         // who wish to do post post `widgetcreate` alterations/additions
6         //
7         // TODO create a pull request for jquery ui to trigger this event
8         // in the original _createWidget
9         _createWidget: function() {
10                 $.Widget.prototype._createWidget.apply( this, arguments );
11                 this._trigger( 'init' );
12         },
13
14         _getCreateOptions: function() {
15
16                 var elem = this.element,
17                         options = {};
18
19                 $.each( this.options, function( option ) {
20
21                         var value = elem.jqmData( option.replace( /[A-Z]/g, function( c ) {
22                                                         return "-" + c.toLowerCase();
23                                                 })
24                                         );
25
26                         if ( value !== undefined ) {
27                                 options[ option ] = value;
28                         }
29                 });
30
31                 return options;
32         },
33
34         enhanceWithin: function( target, useKeepNative ) {
35                 this.enhance( $( this.options.initSelector, $( target )), useKeepNative );
36         },
37
38         enhance: function( targets, useKeepNative ) {
39                 var page, keepNative, $widgetElements = $( targets ), self = this;
40
41                 // if ignoreContentEnabled is set to true the framework should
42                 // only enhance the selected elements when they do NOT have a
43                 // parent with the data-namespace-ignore attribute
44                 $widgetElements = $.mobile.enhanceable( $widgetElements );
45
46                 if ( useKeepNative && $widgetElements.length ) {
47                         // TODO remove dependency on the page widget for the keepNative.
48                         // Currently the keepNative value is defined on the page prototype so
49                         // the method is as well
50                         page = $.mobile.closestPageData( $widgetElements );
51                         keepNative = ( page && page.keepNativeSelector()) || "";
52
53                         $widgetElements = $widgetElements.not( keepNative );
54                 }
55
56                 $widgetElements[ this.widgetName ]();
57         },
58
59         raise: function( msg ) {
60                 throw "Widget [" + this.widgetName + "]: " + msg;
61         }
62 });
63
64 })( jQuery );