I'd like to start that I know that there are a lot of question and answers to my question by I did not see one strong monovalent solution. My question is how to get JQuery selector string value that was depricated on 1.7 and removed (for my opinion with no reason) in 1.9: For example:
$image.parents('[class*=wrapper_zml]').selector \\returns '[class*=wrapper_zml]'
$('[id*=test]').selector \\returns '[id*=test]'
$image.parent().children('[src*="-icon-"]').selector \\ returns '[src*="-icon-"]'
I'd tried this solution from this answer:
jQuery.fn._init = jQuery.fn.init
jQuery.fn.init = function( selector, context ) {
return (typeof selector === 'string') ? jQuery.fn._init(selector, context).data('selector', selector) : jQuery.fn._init( selector, context );
};
jQuery.fn.getSelector = function() {
return jQuery(this).data('selector');
};
But in JQuery 2.1.4 it breaks append and prepend functions thus I got such console error:
TypeError: Cannot read property 'createDocumentFragment' of undefined at Function.jQuery.extend.buildFragment (chrome-extension://khehkclcpkokmaickfndjjalcoggbkme/js/jquery.js:5087:22) at jQuery.fn.extend.domManip (chrome-extension://khehkclcpkokmaickfndjjalcoggbkme/js/jquery.js:5387:22) at jQuery.fn.extend.append (chrome-extension://khehkclcpkokmaickfndjjalcoggbkme/js/jquery.js:5218:15)
Thanks for help guys!