-
-
Save iptpv/d87e8494d5c793d520df966793291541 to your computer and use it in GitHub Desktop.
component idea, booking com inspired
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var L = { | |
}; | |
L.alert = function() { | |
console.log($(this).html()+1); | |
}; | |
L.cons = function() { | |
console.log($(this).html()); | |
}; | |
$.fn.loadComponents = function() { | |
$(this).filter('[data-c]').each(L[$(this).data('c')]); | |
}; | |
$('[data-c="cons"]').loadComponents(); | |
$('<div data-c="alert">o0</div><div data-c="cons">o07</div>').appendTo('body').loadComponents(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment