Skip to content

Commit

Permalink
WICKET-7065 replace inline js with header item
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Meier committed Sep 8, 2023
1 parent cc1503c commit 6eaaa5a
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.head.OnEventHeaderItem;
import org.apache.wicket.markup.head.OnLoadHeaderItem;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
Expand Down Expand Up @@ -140,11 +141,9 @@ public void bind(Component component)
}

@Override
public void onComponentTag(final Component component, final ComponentTag tag)
{
tag.put("onfocus", getFocusTrackingHandler(component));

super.onComponentTag(component, tag);
public void renderHead(Component component, IHeaderResponse response) {
response.render(OnEventHeaderItem.forComponent(component, "focus",
getFocusTrackingHandler(component)));
}
});
}
Expand Down

0 comments on commit 6eaaa5a

Please sign in to comment.