开发者

blank space on google home page

2 questions, i was doing nothing productive, and tried selecting the google home page (a left click drag and select whole page) on google.com

i see that beside the search box, on the left side, there is an empty space &nbsp; i looked up the source code and there indeed was a <td width=25%>&nbsp;</td> stupid as it may sound, but i was still curious to know why the blank space is out there..or is it just a simple typo?? :)

also, any idea what window.lol&&lol() does开发者_如何学C? curious yet again, google search didnt get me any result and i thought i would turn to stackoverflow to enlighten me...

thanks, ivar


i see that beside the search box, on the left side, there is an empty space   i looked up the source code and there indeed was a   stupid as it may sound, but i was still curious to know why the blank space is out there..or is it just a simple typo?? :)
This is probably to ensure that the row containing that cell has the minimum height of the height of a line. Perhaps the search bar [which is on the same table row as the cell specified in your question] is sized to 100% of the height of its containing cell?

also, any idea what window.lol&&lol() does? curious yet again, google search didnt get me any result and i thought i would turn to stackoverflow to enlighten me...
If window.lol is defined [and it isn't] the lol is called.


For the first part, its probably just a spacer cell to help with layout.

for the second part, that checks that the lol function exists in global scope and evaluates the result of it if it does exist. otherwise it never gets to executing the function thus preventing an error.

to clarify if you have the following:

if (window.lol)

this evaluates to true if lol exists in global scope.

if (lol())

this evaluates the result of lol as a boolean

put them together and its just a slightly more complex boolean evaluation


There's a 25% td with empty content on both sides of the search box. It's how google forces the middle td with the search input box to the center with ~50% width.

window.x && x() is a simple way of saying "call x(), but only if it exists in the window scope." Due to how the && operator works (it's short-circuiting), the second half is only evaluated if the first half is true. Since null values are false, if the function doesn't exist in window scope, the && short-circuits and the function is never actually called, preventing a Javascript error.


I think the better question is... why is Google still using tables for layout?


if can be of interest for window.lol question in all browesers unlike Chrome the lol property is defined and the lol.toString() return this:

function (){


try{
    if(a.i.p){
        var b=276,
c=document.getElementById(a.i.v.da);
c&&(b=Math.max(b,c.offsetWidth));
var d=parseInt(a.i.p.style.right,10)||0;a.i.p.style.visibility=2*(a.i.p.offsetWidth+d)+b>document.body.clientWidth?"hidden":""
}
}catch(e){
 //google.ml(e,!1,{cause:a.i.s+"_HOSW"})
}

}

another strange thing is that this behavior seems to be extemely random!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜