Permalink
Browse files

fix safari 9.1.2重写innerHTML BUG

  • Loading branch information...
1 parent 49d0581 commit 51add17dc01127fb5a9f361528c296e5246d2191 RubyLouvre committed Aug 19, 2016
Showing with 47 additions and 10 deletions.
  1. +1 −1 dist/avalon.js
  2. +11 −2 dist/avalon.modern.js
  3. +11 −2 dist/avalon.next.js
  4. +12 −3 dist/avalon.test.js
  5. +2 −1 karma.conf.js
  6. +10 −1 src/component/dispose.modern.js
View
@@ -1,5 +1,5 @@
/*!
- * built in 2016-8-19:11 version 2.111 by 司徒正美
+ * built in 2016-8-19:12 version 2.111 by 司徒正美
* 2.1.4 and npm 2.1.12
* 修正 ms-skip BUG
* 去掉节点生成算法
View
@@ -1,5 +1,5 @@
/*!
- * built in 2016-8-19:11 version 2.111 by 司徒正美
+ * built in 2016-8-19:12 version 2.111 by 司徒正美
* 2.1.4 and npm 2.1.12
* 修正 ms-skip BUG
* 去掉节点生成算法
@@ -7816,7 +7816,16 @@ return /******/ (function(modules) { // webpackBootstrap
var obj = Object.getOwnPropertyDescriptor(ep, 'innerHTML')
var oldSetter = obj.set
obj.set = newSetter
- Object.defineProperty(ep, 'innerHTML', obj)
+ try {
+ Object.defineProperty(ep, 'innerHTML', obj)
+ } catch (e) {
+ //safari 9.1.2使用Object.defineProperty重写innerHTML会抛
+ // Attempting to change the setter of an unconfigurable property.
+ if (ep._lookupSetter__) {
+ oldSetter = ep.__lookupSetter__('innerHTML')
+ ep.__defineSetter__('innerHTML', newSetter)
+ }
+ }
rewite('appendChild', function (fn, a) {
View
@@ -1,5 +1,5 @@
/*!
- * built in 2016-8-19:11 version 2.111 by 司徒正美
+ * built in 2016-8-19:12 version 2.111 by 司徒正美
* 2.1.4 and npm 2.1.12
* 修正 ms-skip BUG
* 去掉节点生成算法
@@ -7432,7 +7432,16 @@ return /******/ (function(modules) { // webpackBootstrap
var obj = Object.getOwnPropertyDescriptor(ep, 'innerHTML')
var oldSetter = obj.set
obj.set = newSetter
- Object.defineProperty(ep, 'innerHTML', obj)
+ try {
+ Object.defineProperty(ep, 'innerHTML', obj)
+ } catch (e) {
+ //safari 9.1.2使用Object.defineProperty重写innerHTML会抛
+ // Attempting to change the setter of an unconfigurable property.
+ if (ep._lookupSetter__) {
+ oldSetter = ep.__lookupSetter__('innerHTML')
+ ep.__defineSetter__('innerHTML', newSetter)
+ }
+ }
rewite('appendChild', function (fn, a) {
View
@@ -1,5 +1,5 @@
/*!
- * built in 2016-8-19:11 version 2.111 by 司徒正美
+ * built in 2016-8-19:12 version 2.111 by 司徒正美
* 2.1.4 and npm 2.1.12
* 修正 ms-skip BUG
* 去掉节点生成算法
@@ -80,7 +80,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) {
/*!
- * built in 2016-8-19:11 version 2.111 by 司徒正美
+ * built in 2016-8-19:12 version 2.111 by 司徒正美
* 2.1.4 and npm 2.1.12
* 修正 ms-skip BUG
* 去掉节点生成算法
@@ -7897,7 +7897,16 @@ return /******/ (function(modules) { // webpackBootstrap
var obj = Object.getOwnPropertyDescriptor(ep, 'innerHTML')
var oldSetter = obj.set
obj.set = newSetter
- Object.defineProperty(ep, 'innerHTML', obj)
+ try {
+ Object.defineProperty(ep, 'innerHTML', obj)
+ } catch (e) {
+ //safari 9.1.2使用Object.defineProperty重写innerHTML会抛
+ // Attempting to change the setter of an unconfigurable property.
+ if (ep._lookupSetter__) {
+ oldSetter = ep.__lookupSetter__('innerHTML')
+ ep.__defineSetter__('innerHTML', newSetter)
+ }
+ }
rewite('appendChild', function (fn, a) {
View
@@ -38,12 +38,13 @@ module.exports = function (config) {
//autoWatch为true,Karma将自动执行测试用例
autoWatch: true,
//http://www.cnblogs.com/NetSos/p/4371075.html
- browsers: ['Chrome','IE'],
+ browsers: ['Firefox'],
singleRun: false,
plugins: [
'karma-mocha',
'karma-mocha-reporter',
'karma-firefox-launcher',
+ 'karma-safari-launcher',
'karma-chrome-launcher',
'karma-ie-launcher',
'karma-opera-launcher',
@@ -43,7 +43,16 @@ function byRewritePrototype() {
var obj = Object.getOwnPropertyDescriptor(ep, 'innerHTML')
var oldSetter = obj.set
obj.set = newSetter
- Object.defineProperty(ep, 'innerHTML', obj)
+ try {
+ Object.defineProperty(ep, 'innerHTML', obj)
+ } catch (e) {
+ //safari 9.1.2使用Object.defineProperty重写innerHTML会抛
+ // Attempting to change the setter of an unconfigurable property.
+ if (ep._lookupSetter__) {
+ oldSetter = ep.__lookupSetter__('innerHTML')
+ ep.__defineSetter__('innerHTML', newSetter)
+ }
+ }
rewite('appendChild', function (fn, a) {

0 comments on commit 51add17

Please sign in to comment.