cm-chessboard 7.7.8 → 7.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.html CHANGED
@@ -48,8 +48,11 @@ It works, it is cool and it is easy to use. 👍</p>
48
48
  const interval = setInterval(() => {
49
49
  makeRandomMove()
50
50
  board.setPosition(chess.fen(), true)
51
- }, 1000)
51
+ }, 500)
52
52
  function makeRandomMove() {
53
+ if(chess.game_over()) {
54
+ chess.reset()
55
+ }
53
56
  const possibleMoves = chess.moves()
54
57
  if (possibleMoves.length === 0) {
55
58
  clearInterval(interval)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "7.7.8",
3
+ "version": "7.7.10",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
package/src/lib/Svg.js CHANGED
@@ -24,7 +24,7 @@ export class Svg {
24
24
  }
25
25
 
26
26
  /**
27
- * Add an Element to a SVG DOM
27
+ * Add an Element to an SVG DOM
28
28
  * @param parent
29
29
  * @param name
30
30
  * @param attributes
@@ -50,10 +50,14 @@ export class Svg {
50
50
  }
51
51
 
52
52
  /**
53
- * Remove an Element from a SVG DOM
53
+ * Remove an element from an SVG DOM
54
54
  * @param element
55
55
  */
56
56
  static removeElement(element) {
57
+ if(!element) {
58
+ console.warn("removeElement, element is", element)
59
+ return
60
+ }
57
61
  if (element.parentNode) {
58
62
  element.parentNode.removeChild(element)
59
63
  } else {