问题
The problem I have is that in MS edge, my imagemap functionality's only work partially. It is powered by the knockout FW. On bigger imagemaps, it doesn't registers the entire imagemap into the viewmodel. As a result all the hover effects and the on-click styling for the imagemap stops working.
However this is only issue with big imagemaps, also noteworthy is that the part that is registered does have the on-click function triggered (just not the styling).
The most remarkable problem with this is that i can't debug it, if i enter the debug console and refresh the page, it does work.
this is the image map code rendered with Razor:
<div id="seatplan" data-bind="visible:maximumReached">
<img id="mapSeatPlan" src="@Url.Action("MyImage", "Show", new { uid = Model.Show.RowGuid })" alt="seatplan" usemap="#plan_met" />
<map name="plan_met" id="plan_met">
@foreach (var seat in seats)
{
<area shape="rect" href="#" data-seat="@seat.RowGuid" coords="@seat.CoordX,@seat.CoordY,@(seat.CoordX + seat.CoordWidth),@(seat.CoordY + seat.CoordHeight)" alt="@seat.RowName @seat.DisplayName" />
}
</map></div>
and this is the JS that registers the area's in an array:
function buildAreas() {
var items = $('#plan_met').find('area');
var areaArray = [];
items.each(function () {
var areaName = $(this).attr('data-seat');
var fullName = $(this).attr('alt');
var newarea = {
key: areaName,
toolTip: buildToolTipArea(areaName, fullName)
};
if (isSelected(areaName)) newarea.selected = true;
areaArray.push(newarea);
});
return areaArray;
}
The code does work as intented on every browser but Edge, and does work in Edge as intented if the dev tools are open. Is there some limit on something that could break JS in the Chakra engine that gets unlocked with the dev tools? If yes, how can I get this working?
update : https://bitbucket.org/dampeebvba/issue-1303/src I have reproduced the issue without knockout, i had to use Jquery because of the imagemapper plugin. I'd like to emphasize again that it works in every browser including internet explorer, and does work in edge but only if u refresh the page with dev tools open. And also that the on-click in edge will work untill somewhere in the 140's.
来源:https://stackoverflow.com/questions/37593802/javascript-in-edge-only-works-with-devtools-open