提交 d849df46 编写于 作者: K kohsuke

fixed #581 "hudson-behavior.js#makeTooltip make a memory leak"


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3427 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9b4c8adc
......@@ -19,9 +19,8 @@
<img width="16" height="16" src="${rootURL}/images/16x16/grey.gif" alt="pending" /><st:nbsp/>
#${it.nextBuildNumber}
</td>
<td nowrap="nowrap">
<td nowrap="nowrap" tooltip="${pending.why}">
(pending)
<t:tooltip id="${id}">${pending.why}</t:tooltip>
</td>
</tr>
</j:if>
......
......@@ -5,7 +5,6 @@
@build: build in progress
-->
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:set var="id" value="${h.generateId()}"/>
<t:progressBar id="${id}" pos="${build.executor.progress}" href="${rootURL}/${build.url}console"/>
<t:tooltip id="${id}">Started ${build.timestampString} ago&lt;br> Estimated remaining time: ${build.executor.estimatedRemainingTime}</t:tooltip>
<t:progressBar tooltip="Started ${build.timestampString} ago&lt;br&gt; Estimated remaining time: ${build.executor.estimatedRemainingTime}"
pos="${build.executor.progress}" href="${rootURL}/${build.url}console"/>
</j:jelly>
......@@ -10,6 +10,9 @@
<j:if test="${attrs.id!=null}">
<x:attribute name="id">${id}</x:attribute>
</j:if>
<j:if test="${attrs.tooltip!=null}">
<x:attribute name="tooltip">${tooltip}</x:attribute>
</j:if>
<j:if test="${href!=null}">
<x:attribute name="style">cursor:pointer</x:attribute>
<x:attribute name="onclick">window.location='${href}'</x:attribute>
......
......@@ -29,12 +29,10 @@
</j:if>
<j:forEach var="item" items="${items}">
<tr>
<j:set var="id" value="${h.generateId()}"/>
<td class="pane" width="100%" id="${id}">
<td class="pane" width="100%" tooltip="${item.why}">
<a href="${rootURL}/${item.task.url}">
${item.task.name}
</a>
<t:tooltip id="${id}">${item.why}</t:tooltip>
</td>
<td class="pane" width="16" align="center" valign="middle">
<l:isAdmin>
......
......@@ -63,6 +63,8 @@ function findFollowingTR(input,className) {
return tr;
}
// shared tooltip object
var tooltip;
......@@ -70,6 +72,10 @@ function findFollowingTR(input,className) {
//========================================================
var hudsonRules = {
"BODY" : function(e) {
tooltip = new YAHOO.widget.Tooltip("tt",{context:[]});
},
".advancedButton" : function(e) {
e.onclick = function() {
var link = this.parentNode;
......@@ -193,6 +199,16 @@ var hudsonRules = {
ip = ip.previousSibling;
// set up the logic
object(repetableSupport).init( e, e.firstChild, ip);
},
// hook up tooltip
"[tooltip]" : function(e) {
// copied from YAHOO.widget.Tooltip.prototype.configContext to efficiently add a new element
var event = YAHOO.util.Event;
event.addListener(e, "mouseover", tooltip.onContextMouseOver, tooltip);
event.addListener(e, "mousemove", tooltip.onContextMouseMove, tooltip);
event.addListener(e, "mouseout", tooltip.onContextMouseOut, tooltip);
e.title = e.getAttribute("tooltip");
}
};
......@@ -338,7 +354,9 @@ function refreshPart(id,url) {
var div = document.createElement('div');
div.innerHTML = rsp.responseText;
p.insertBefore(div.firstChild, next);
var node = div.firstChild;
p.insertBefore(node, next);
Behaviour.applySubtree(node);
}
});
}, 5000);
......@@ -386,16 +404,6 @@ function encode(str){
return s0;
}
// create a tooltip that applies to the element of the specified ID.
// @param text
// HTML text of the tooltip
function makeTooltip(id,text) {
new YAHOO.widget.Tooltip("tooltip-"+id, {
context:id,
text:text,
showDelay:500 } );
}
// when there are multiple form elements of the same name,
// this method returns the input field of the given name that pairs up
// with the specified 'base' input element.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册