Skip to content

Commit

Permalink
Added namespace checking and correction to numerous plugins and polyf…
Browse files Browse the repository at this point in the history
…ills to avoid cross-plugin/polyfill triggering of events
  • Loading branch information
pjackson28 committed Jul 22, 2014
1 parent e75ff95 commit 33e4bf6
Show file tree
Hide file tree
Showing 19 changed files with 664 additions and 609 deletions.
16 changes: 8 additions & 8 deletions src/other/tablevalidator/demo/tablevalidator.js
Expand Up @@ -14,15 +14,15 @@

var pluginName = "wb-tblvalidator",
selector = "." + pluginName,
tableParsingEvent = "pasiveparse.wb-tableparser.wb",
tableParsingCompleteEvent = "parsecomplete.wb-tableparser.wb",
tableParsingEvent = "passiveparse.wb-tableparser",
tableParsingCompleteEvent = "parsecomplete.wb-tableparser",
$document = wb.doc,
modeJS = wb.getMode( ) + ".js",
addidheadersEvent = "idsheaders." + pluginName + ".wb",
addscopeEvent = "scope." + pluginName + ".wb",
addnothingEvent = "simple." + pluginName + ".wb",
showHTMLEvent = "showhtml." + pluginName + ".wb",
logEvent = "log." + pluginName + ".wb",
addidheadersEvent = "idsheaders" + selector,
addscopeEvent = "scope" + selector,
addnothingEvent = "simple" + selector,
showHTMLEvent = "showhtml" + selector,
logEvent = "log" + selector,
formSelector = "#formtablevalidator",
ErrorMessage = {
"%tblparser1": "Only table can be parsed with this parser",
Expand Down Expand Up @@ -574,7 +574,7 @@ $document.on( addnothingEvent, "#visualoutput > table:eq( 0 )", function( event
} );

// Check the minimum accessibility requirement
$document.on( "parsecomplete.wb-tableparser.wb", "#visualoutput > table:eq( 0 )", function( event ) {
$document.on( tableParsingCompleteEvent, "#visualoutput > table:eq( 0 )", function( event ) {
var elm = event.target,
$elm, options,
tblparser,
Expand Down
30 changes: 19 additions & 11 deletions src/plugins/cal-events/cal-events.js
Expand Up @@ -42,7 +42,7 @@ var pluginName = "wb-calevt",
}

// Load ajax content
$.when.apply($, $.map( $elm.find( "[data-calevt]" ), getAjax))
$.when.apply( $, $.map( $elm.find( "[data-calevt]" ), getAjax ) )
.always( function() {
processEvents( $elm );
});
Expand Down Expand Up @@ -334,8 +334,12 @@ var pluginName = "wb-calevt",
};

// Bind the init event of the plugin
$document.on( "timerpoke.wb " + initEvent, selector, function() {
init( $( this ) );
$document.on( "timerpoke.wb " + initEvent, selector, function( event ) {

// Filter out any events triggered by descendants
if ( event.currentTarget === event.target ) {
init( $( this ) );
}

/*
* Since we are working with events we want to ensure that we are being passive about our control,
Expand All @@ -345,14 +349,18 @@ $document.on( "timerpoke.wb " + initEvent, selector, function() {
});

$document.on( "displayed.wb-cal", selector + "-cal", function( event, year, month, days, day ) {
var target = event.target,
$target = $( target ),
containerId = target.id,
events = $target.data( "calEvents" );

addEvents( year, month, days, containerId, events.list );
showOnlyEventsFor( year, month, containerId );
$target.find( ".cal-index-" + day + " .cal-evt" ).trigger( "setfocus.wb" );

// Filter out any events triggered by descendants
if ( event.currentTarget === event.target ) {
var target = event.target,
$target = $( target ),
containerId = target.id,
events = $target.data( "calEvents" );

addEvents( year, month, days, containerId, events.list );
showOnlyEventsFor( year, month, containerId );
$target.find( ".cal-index-" + day + " .cal-evt" ).trigger( "setfocus.wb" );
}
});

$document.on( "focusin focusout", ".wb-calevt-cal .cal-days a", function( event ) {
Expand Down

0 comments on commit 33e4bf6

Please sign in to comment.