저는 Google 컴파일러를 처음 사용하고 몇 가지 문제에 부딪치고 있습니다. 첫 번째는 내 전처리 된 코드에서 빈 배열을 나중에 채울 변수에 설정하는 것입니다.하지만 컴파일 할 때 나중에 변수를 사용할 때 정의되지 않도록 변수를 모두 제거합니다.Google 컴파일러가 빈 배열을 변수에 할당하지 않습니까?
다음은 약간 수정 한 코드입니다. 나는 다음과 같은 플래그를 사용하고, 컴파일러 설정의
/**
* Equal Heights
*
* @see https://css-tricks.com/equal-height-blocks-in-rows/
*/
goog.provide('EqualHeights');
(function($) {
// = Equalize columns on load and resize
equal_heights();
$(window).resize(function() {
equal_heights();
})
var currentTallest = 0;
var currentRowStart = 0;
var rowDivs = new Array();
function setConformingHeight(el, newHeight) {
// set the height to something new, but remember the original height in case things change
el.data("originalHeight", (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight")));
el.height(newHeight);
}
function getOriginalHeight(el) {
// if the height has changed, send the originalHeight
return (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight"));
}
function equal_heights() {
// find the tallest DIV in the row, and set the heights of all of the DIVs to match it.
$('[data-equalizer-watch]').each(function() {
// "caching"
var $el = $(this);
var topPosition = $el.position().top;
if (currentRowStart != topPosition) {
// we just came to a new row. Set all the heights on the completed row
for(currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) setConformingHeight(rowDivs[currentDiv], currentTallest);
// set the variables for the new row
rowDivs.length = 0;
// empty the array
currentRowStart = topPosition;
currentTallest = getOriginalHeight($el);
rowDivs.push($el);
}
else {
// another div on the current row. Add it to the list and check if it's taller
rowDivs.push($el);
currentTallest = (currentTallest < getOriginalHeight($el)) ? (getOriginalHeight($el)) : (currentTallest);
}
});
// do the last row
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
setConformingHeight(rowDivs[currentDiv], currentTallest);
}
}
})(jQuery);
: 선 (19)는 그렇게 때문에 rowDivs 라인 (44)에 정의되지 않은 게재되어 제거되는 끝납니다. 아마 뭔가를 분명 실종
--closure_entry_point main.js
--externs node_modules/google-closure-compiler/contrib/externs/jquery-1.9.js
--language_in ECMASCRIPTS5
--warning_level: VERBOSE
을하지만, 단지 궤도에 싶어 : 나는 심지어 고급 최적화 합병증 레벨을 사용하지하고 있습니다. 감사.