1
0
mirror of synced 2024-11-22 13:06:08 +03:00

Better extract width style from inline element :

- Match floating point numbers as well as integers (e.g. "width:99.5%")
  - Strip all string spaces, to match styles specified with variable spacing (e.g. "   width:   5em  ;")
This commit is contained in:
Justin DuJardin 2012-03-28 10:22:02 -07:00
parent 26baca110b
commit 55a257ddba

View File

@ -607,8 +607,8 @@
var style = this.opts.element.attr('style'); var style = this.opts.element.attr('style');
var attrs = style.split(';'); var attrs = style.split(';');
for (var i = 0; i < attrs.length; i++) { for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i].trim(); var matches = attrs[i].replace(/\s/g,'')
var matches = attr.match(/width:(([0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/); .match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/);
if(matches == null || matches.length < 1) if(matches == null || matches.length < 1)
continue; continue;
return matches[1]; return matches[1];
@ -827,6 +827,14 @@
this.search.val(""); this.search.val("");
}; };
SingleSelect2.prototype.alignDropdown = function () {
this.parent.alignDropdown.apply(this,arguments);
this.results.css({
'margin-top': this.search.height()
});
};
function MultiSelect2(opts) { function MultiSelect2(opts) {
} }