Comments (7)
Can you provide some details about the setup, what is different than the knockout.js samples?
*Are you using AMD?
*Any external templating engine? (if so, there are setups that have problems #9)
Is the website public available? That would be great :)
I have put some additional info in the wiki page in case you want to investigate this further.
https://github.com/timstuyckens/chromeextensions-knockoutjs/wiki/Contribute (see Catch )
I also released a new version (2.3) that contains some additional error handling ( cab93a7 and 4e08bfd ) . This might show the root cause.
from chromeextensions-knockoutjs.
I'm not using AMD nor an external template engine.
You can access the site at http://cms.uplynk.com/static/cms/index.html. You will have to sign up for a new account, or I can set up a test account for you if you'd like.
I will continue to investigate with the new version you've put out, too.
from chromeextensions-knockoutjs.
It looks like
copy["$root_toJS"] = ko.toJS(context[props[i]]);
is causing the problem. ko.toJS() causes the error TypeError: Accessing selectionDirection on an input element that cannot have a selection.
from chromeextensions-knockoutjs.
For future reference: I believe this is because there is a DOM object in there, and DOM elements seem to be notorious for being difficult to serialize because of things like circular references in them.
I'm coming back to javascript after a break of many years, so if I'm wrong here I'm happy to continue digging. But this is my current guess, and I don't know if there's a good way around it at this point. Maybe "scrub" the rootObject that's being processed of any DOM elements before turning it into JS?
from chromeextensions-knockoutjs.
Short answer: no quick fix voor $root_toJS, but at least you can see the $data and bounded properties.
Long answer:
Normally you shouldn't have any dom elements in your viewmodel. If you do MVVM 100% correct you will never have to do any jQuery stuff in the viewmodel.
I took a short look at uplynck CMS (which looked really cool) and I think you can improve the knockout code, if you do so, the plugin will also work.
- First: upgrade to 2.* It has a lot of awesome features, see http://blog.stevensanderson.com/2011/12/21/knockout-2-0-0-released/ for more details
- You can use point 4 of the blog post to extract the dom manipulation out of the viewmodel
- For things like popups, creating a custom binding is often a solution. If you use plugins, changes are pretty good somebody already wrote a custom binding.
I don't like the idea of implementing a 'scrub' like thing because it is not the correct way of using knockout.
from chromeextensions-knockoutjs.
I'm actually in the process of moving our CMS to 2.x which is what started me down this path. I appreciate your input and ideas on that. The code is pretty old now and I'm working on bringing it up to "modern" KO.
Fair enough on the scrubbing. I'm still new to KO so I appreciate your insight there, as well.
from chromeextensions-knockoutjs.
@cygnl7 You might want to check out the new option: #9 (comment)
from chromeextensions-knockoutjs.
Related Issues (20)
- There should be a way to refresh "Knockout context" panel automaticaly when model/context is changed HOT 1
- Not working on Chrome 46 HOT 1
- Proper documentation on how to use? HOT 2
- get All context data as JSON format HOT 2
- Excessive memory usage. HOT 2
- debugger doesn't work in iframes HOT 2
- Recent upgrade replaces excellent debugger with some blurb ... I can't remove it HOT 3
- ko not found in webpack project HOT 3
- Problem with the order of the attributes HOT 6
- Privacy statement HOT 2
- Updating from ko 3.4.0 to 3.5.1 causes 99% CPU usage + freeze. HOT 1
- Extension not working in the latest version of Google Chrome HOT 14
- Update to WebExtensions API to support Firefox browser HOT 3
- Google says 'This extension violates the Chrome Web Store policy'. HOT 4
- Chrome extension not in store anymore
- Outdated manifest version
- Removed from Chrome Web Store HOT 13
- KO is undefined while using ECMA imports HOT 2
- Knockout.js not found warning HOT 1
- Can't get this to show in the dev tools anymore. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chromeextensions-knockoutjs.