2
나는 확장하고있는 jquery-Ui 위젯의 소스를 읽고 있는데, 나는이 한 줄의 코드로 완전히 난처하게된다.jQuery UI - 이것은 무엇을 의미합니까?
this.placeholder["next"]()[0] !== itemElement
this.placeholder["prev"]()[0] !== itemElement
가해야 할 노력 일 : 위의 두 가지로 동일시 수 있음을 의미
this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement
내가 올바르게 이해하면? 어떻게 배열 키를 실행할 수 있습니까? this.placeholder
이 정의된다
입니다 :
_createPlaceholder: function(that) {
that = that || this;
var className,
o = that.options;
if(!o.placeholder || o.placeholder.constructor === String) {
className = o.placeholder;
o.placeholder = {
element: function() {
var nodeName = that.currentItem[0].nodeName.toLowerCase(),
element = $("<" + nodeName + ">", that.document[0])
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
.removeClass("ui-sortable-helper");
if (nodeName === "tr") {
that.currentItem.children().each(function() {
$("<td> </td>", that.document[0])
.attr("colspan", $(this).attr("colspan") || 1)
.appendTo(element);
});
} else if (nodeName === "img") {
element.attr("src", that.currentItem.attr("src"));
}
if (!className) {
element.css("visibility", "hidden");
}
return element;
},
update: function(container, p) {
// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
if(className && !o.forcePlaceholderSize) {
return;
}
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
}
};
}
//Create the placeholder
that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
//Append it after the actual current item
that.currentItem.after(that.placeholder);
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
o.placeholder.update(that, that.placeholder);
}
사람이 내가 정말 감사하겠습니다이 되거 수 있다면.
Ahhh 표기법. 네가 할 수 있다는 것을 나는 몰랐다. 감사! – Nikita240