1

To recreate this problem, here is some sample code taken from Steve Pembertons Xforms for HTML authors tutorial.

After a few random clicks of the New and Delete buttons the UI will freeze and stop responding to further clicks because the model has gotten out of sync with the view (i.e they reflect differing number of instances of the repeating construct)

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://www.w3.org/1999/xhtml"
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<head>
	<title>To do</title>

	<style type="text/css">
	  body { font-family: sans-serif}
	  label { display: inline-block; width: 3em; margin: 0 1em }
          .xforms-repeat-item-selected { background: yellow}
	</style> 

	<xf:model>
   		<xf:instance src="todo.xml"/>
		<xf:instance id="template">
			<items xmlns="">
				<todo><task/><status>unstarted</status><date/></todo>
			</items>
		</xf:instance>
   		<xf:submission id="save" method="put" action="todo.xml" replace="none"/>
   		<xf:bind nodeset="todo/date" type="xsd:date"/>
	</xf:model>
</head>
<body>
    <xf:group>
	<xf:repeat nodeset="todo" id="todo-repeat">
	   <xf:input ref="date"><xf:label>Date</xf:label></xf:input>
	   <xf:select1 ref="status" selection="open">
	      <xf:label>Status</xf:label>
	      <xf:item><xf:label>Not started</xf:label><xf:value>unstarted</xf:value></xf:item>
	      <xf:item><xf:label>In Progress</xf:label><xf:value>started</xf:value></xf:item>
	      <xf:item><xf:label>Done</xf:label><xf:value>finished</xf:value></xf:item>
	   </xf:select1>
	   <xf:input ref="task"><xf:label>Task</xf:label></xf:input>
	   <xf:trigger>
	      <xf:label>Delete</xf:label>
	      <xf:delete ev:event="DOMActivate" nodeset="." at="1" />
	   </xf:trigger>
	</xf:repeat>
    </xf:group>
    <xf:trigger>
       <xf:label>New</xf:label>
       <xf:action ev:event="DOMActivate">
	    <xf:insert context="/items" origin="instance('template')/todo" nodeset="todo" position="after" at="count(todo)"/>
	    <xf:setvalue ref="todo[last()]/date" value="substring-before(now(), 'T')"/>
       </xf:action>
    </xf:trigger>
    <xf:submit submission="save"><xf:label>Save</xf:label></xf:submit>
</body>
</html>

4

1 回答 1

1

此问题已定位:这是由于对已删除的 HTML 对象的事件处理。实际上,删除最后一个重复项就足以重现它。之后,即使更改了 XLSTForms 引擎,一些 Javascript 执行仍然可能导致所有麻烦......

显然,这只发生在最近的 Chrome 版本中,并且 Javascript 源代码中的异常出现在控制台中,表明没有找到该事件的元素。

忽略那些僵尸事件听起来很棒!这已在所有最近的浏览器中成功测试,并将尽快提交。

-阿兰

于 2018-09-30T09:56:50.023 回答