Questions tagged [prototypejs]
Prototype is a JavaScript Framework that extends built-in classes to ease JS development. Do not use this tag for questions about the JS prototype object extension, as that is unrelated
2,769
questions
0
votes
2
answers
100
views
How can I override the behavior of valueOf() as a prototype of the Number in JavaScript?
I was given a task to understand the .toString and .valueOf methods, who calls them, where they are used, how they work, how they are called and how to change calling sequence.
I am getting an error ...
0
votes
2
answers
30
views
How to make one method from prototype show another variable from another method
I want the display() method to show the average Student.
"this" doesn't work and I can't imagine how to do it any other way.
here is my code.
function Student(name, age, grades) {
this....
0
votes
0
answers
71
views
MODULE_NOT_FOUND in node.js
first of all, VERY new to programming.
im trying to decompile a.vpd file to a .json file and found a .js that does that but it gives me this error: (note the example for the code typing is "node ...
0
votes
3
answers
77
views
Confusion about Object.create() vs Object Literals
I am currently completing the front-end web development course offered by Meta.
I am confused with the usage of Object.create() and Object Literals. Let's use the following code for the reference:
let ...
2
votes
0
answers
46
views
Constructor inheritance questions
I started reading about inheritance in constructors (everything is clear in classes) and ran into some problems and misunderstandings. Could you explain to me which code practices are normal and which ...
0
votes
0
answers
44
views
Does all Object refers to same Prototype Object on top of prototype chain in javascript?
I run following code and it looks like ultimately all objects have same object prototype on top of prototype chain and then this prototype point to null as its own prototype. does it concludes that ...
0
votes
1
answer
51
views
Element insert before: fetch elements that has been added using insertAfter
In my application we are using tree structure and on each click of + ( expand) ajax call is triggered which renders its respective child elements using Element.insert ( prototype.js)
Now i need to ...
0
votes
0
answers
16
views
Changing same property in Prototype Object is giving 2 different behaviors
I am having problem understanding prototypes in js and can't find an answer to what is happening.
function Person() { } //constructor to create empty Person obj
//confusion starts below, when adding ...
0
votes
0
answers
37
views
Why this refer to window and not to anchor?
Inside an HTML table a link named lnkFullScreen calls the JavaScript function fullscreenmap. Inside the function I need to change the innertext of link but link variable refer to window insted of the ...
0
votes
0
answers
18
views
cheeking the order of execution of javascript code [duplicate]
hello everyone want to understand the order of javascript code
my code
class User {
constructor(id, username) {
this.i = id;
this.u = username;
}
sayHello() {
return `Hello ${this.u}`...
0
votes
0
answers
46
views
Multiple Prototype property with same name in Prototype Chain
I know that object's(instance's) own property has higher priority than properties in instance's .__proto__. But what is the priority order when we have multiple properties with same name inside ...
1
vote
1
answer
57
views
Add a function to the prototype with access to "this" [duplicate]
On the one hand I can assign a new function to an object with
Object.defineProperty(...).
Then I tried to assign a function directly to the NodeList Prototype. But somehow it doesn't work properly. ...
0
votes
1
answer
567
views
Check if period of date, is overlapping any of the given period in the array
I have a module for sales-person, where they can add their own managers. These will be displayed in ag-grid on UI. To add managers I need to select the manager, period start date, and period end date ...
0
votes
1
answer
225
views
Conflict with prototype.js when using element.js (googleTranslateElement) to translating whole web
Example:
Code that works and displays google translate toolbar:
<!doctype html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="...
0
votes
0
answers
32
views
What is the difference between these two prototype in JS? [duplicate]
code 1
var User1 = function (name, age) {
this.name = name;
}
User1.prototype.getName = () => { return this.name; }
var x = new User1("gladiator");
console.log(x.getName());
Output = ...
0
votes
1
answer
702
views
How to build a data model in Protocol Buffers
For example, I need a model like this:
[
{
"type": "input",
"identity": "protocol_buffers_input",
"value": "Input Value",
&...
0
votes
0
answers
66
views
How can I use module in prototype written javascript file?
When I called this js file I got error that I cant use import into kind of this page,How I can use module file into a written prototype js file?
import * as storeDB from './publish.storedb.js';
import ...
0
votes
1
answer
404
views
Uncaught TypeError: lib(...).some is not a function
I am trying create a prototype of function using object.
var lib = function(){
return true;
};
lib.prototype = {
some: () => {
console.log("prototype is called");
}
}
...
1
vote
0
answers
83
views
If to call any Array.prototype function upon a string, does the string get converted to an object? Is it a runtime-friendly operation? (JavaScript)
To clarify the situation, I conducted a simple test, and below is a runnable code snippet:
function test() {
const str = 'abcdef';
alert(Array.prototype.reduce.call(str, (result, _, i, ...
0
votes
0
answers
53
views
Difference between 'new person()' and 'prototype.person' in prototype chaining? [duplicate]
var person = function (name) {
this.myName = name;
}
person.prototype.tellMyName = function () {
console.log(this.myName);
}
var person1 = function (name,age) {
person.call(this,name);
this....
0
votes
1
answer
374
views
Polyfills interfering with reCAPTCHA?
i have recently been facing issues with a polyfill library (Prototype.js) and recaptcha. for some reason its acting dicey and throwing a "Unexpected token x in JSON at position 0" error and ...
1
vote
0
answers
44
views
Are weak set values change its indexes in every reload (Javascript)?
I've created a weak set in js program and pass an object to its constructor then I used .add method to add other objects and then I've console set to result but I've noticed after reloading my page ...
1
vote
1
answer
159
views
Default handler for a functional class in JavaScript
I wanted to know if it is possible to have a functional class have a default call method. Let me elaborate.
function Foo(){
/*some logic*/
Foo.prototype.aletUser = function alertUser(message) {
...
0
votes
0
answers
156
views
Conflict issues with Prototype, jQuery and Highcharts
I am working on a PHP project that was originally using prototype and jQuery to do all of its javascript/ajax magic but was using flash for its charting.
At the point of me looking into it the project ...
0
votes
0
answers
12
views
PrototypeJS classes in JavaScript / jQuery [duplicate]
I'm migrating some PrototypeJS code to pure JS / jQuery, and I'm encountering a problem.
Actually, PrototypeJS allowed to create some classes like "MyClass.Methods"
Here is an exemple :
Form....
0
votes
0
answers
78
views
PrototypeJS fails on chrome 83
I have an old rails webapp that uses prototypeJS and scriptaculous. In Chrome 83, sometimes, the methodized functions don't get their definitions and nothing works, functions remain undefined. Couple ...
0
votes
2
answers
60
views
Tick checkboxes in one cell depending on content in another at the same row level
I need to preselect checkboxes so that I can change their state. Unfortunately I am not a JavaScript guy.
The loop must look something like this
tick:
td.col-clipboard input.smallCheckboxes
if:
td....
0
votes
2
answers
144
views
Making elements appear/disappear with Prototype
I need to make a make elements within a div appear and disappear when the div is clicked. When then webpage is loaded, it should just say "Click here". After clicking, new text saying "Click here ...
0
votes
1
answer
230
views
getOwnPropertyDescriptor of redefined toString should be undefined
I have redefined toString of HTMLCanvasElement.prototype.toDataURL. When I am getting property descriptor of toString it should return undefined, but it returns the function. Any ideas how to fix it?
...
1
vote
1
answer
47
views
jQuery periodical update : how to check whether content fetched is different from old content fetched
I am trying to implement an ajax.periodicalUpdater like that of Prototypejs but with jQuery. My aim is that as soon as the page loads, it will load the content of any url I would have placed in ...
0
votes
2
answers
3k
views
I have changed to PropTypes to "prop-types" but still get Error evaluating React.PropTypes
Environment:
OS: Linux 5.3
Node: 12.16.1
Yarn: 1.21.1
npm: 6.13.4
Watchman: 4.9.0
Xcode: N/A
Android Studio: 3.5 AI-191.8026.42.35.5791312
Packages: (wanted => installed)
react: ^16.3.0-alpha.0 =&...
0
votes
1
answer
44
views
How do you call functions of objects which were created within an array in javascript?
In the below code, the TypeError "database[(0 , 0)].returnVal is not a function" is spat back:
let database = [
[
new DatabaseItem("00", [1, 2, 3, 4], "abcd", ["haiku", "test"]),
...
1
vote
1
answer
65
views
Intermediate value in new created prototype
I've faced a problem which I can't understand. So I created a new function that contains a couple of functions. This is my code:
(() => {
function BetterArray(array) {
this.array = ...
0
votes
1
answer
876
views
JSON.parse(JSON.stringify(e)) converts object to a string
We are integrating the onetrust cookie consent script into a TYPO3 website. On subpages which are run by another CMS, it works, but on the main page it does not.
I tracked down the problem to the ...
0
votes
2
answers
442
views
Why the nested function doesn't becomes the property of the outer function in javascript?
I have a code as follows:
function t() {
var name = "abc";
bar = function() {
console.dir(this);
console.log('bar');
};
};
t.foo = function() {
console.dir(this);
this();
...
0
votes
0
answers
191
views
Adding attribute to prototype function in other file
I have this prototype function defined in a common.js
goog.ui.tree.TreeControl.prototype.enterDocument = function() {
goog.ui.tree.TreeControl.superClass_.enterDocument.call(this);
var a = ...
0
votes
1
answer
81
views
rebuild prototype Ajax POST into "plain" js
What i need is to rebuild prototype.js Ajax request via javascript. (no jQuery / no fetch). IE sopport is required (for some reasons...)
new Ajax.Request(
urlVar,
{
method: 'post',
parameters: {...
1
vote
2
answers
79
views
Use prototype javascript in dom element
Forgot my initial typo in original snippet here is exaly want I trying to do:
How can I use prototyped variable in Dom element event?
Suppose :
function MyProto(){
this.valeur = "toto";
}
...
1
vote
0
answers
934
views
Replacing the Object Function Array.find() in Server-side SuiteScript
So, the JavaScript implementation that NetSuite employs for its server-side processing lacks the Array.find() method, as from what I found because it uses ECMAScript 5.1, and the method was defined in ...
0
votes
1
answer
145
views
new Effect.toggle(argument) in javascript?
At the moment im working on a projects which contains prototype.js + scriptaculous.js and some other things..Im trying to remove these libs. So everything should be done with javascript. But i faced 1 ...
5
votes
2
answers
6k
views
This site overrides Array.from() errors on Magento using prototypejs
Magento 1 use prototypejs, this library overrides Array.form line 1081 in its 1.7 version:
Array.from = $A;
This cause the following JavaScript error in the Console:
This site overrides Array....
6
votes
3
answers
9k
views
Map over two arrays of objects, match properties and store specific info in a new array
New to javascript and trying to learn! I am trying to map through two array of objects, and if a certain property matches, pull in specific information into an array.
let result;
let arrNames = [{
...
0
votes
0
answers
37
views
Problem with scope when inserting results of ajax call into page code
I have data returned from an Ajax call, but need to pass variables into or out of the Ajax onSuccess function to insert the results into my page. I'm pretty sure this is a scope problem.
I posted a ...
0
votes
0
answers
89
views
Difficulty handling return from Ajax call with js and prototype
I am trying to insert an li containing a select after others within a ul, with the data in the options of the select obtained from a database via Ajax, and it's not working.
With apologies in advance ...
0
votes
1
answer
58
views
Is there a way to make this 'undefined' object safe?
On a page in a web app, a loading screen/widget continue to appear after the user leaves the text field.
The app is using version 1.6.0.3. I looked at the most recent version of Prototype 1.7.3 ...
0
votes
0
answers
101
views
Prototype.js Cannot call class as function
I'm having conflicts with the Shopify Javascript Buy SDK and prototype.js. I'm using Magento 1 to implement a custom cart (because using Magento's cart is not feasible for this particular project), ...
0
votes
2
answers
970
views
Form is not embeded with prototype while implementing the symfony form collection example in case whole form is rendered at once
I am trying to follow example posted on page https://symfony.com/doc/master/form/form_collections.html. I am trying to embed into Article form an Author form.
My ArticleType (form class) looks like ...
0
votes
1
answer
669
views
prototypejs - create click event for button with class
I tried it like this:
Event.observe('.add_select_row', 'click', function() {
console.log("KLICK!");
});
But I get "Uncaught TypeError: Cannot read property 'get' of undefined"
I also tried:
...
0
votes
0
answers
106
views
Using Really easy field validation with Prototype - however, yahoo email addresses don't seem to go through. Any ideas?
I'm using the Really easy field validation with prototype by Andrew Tetlaw at https://github.com/atetlaw/Really-Easy-Field-Validation
But for some reason, on my form that I'm using this on, Yahoo ...
0
votes
1
answer
334
views
How to make the ajax updater update all element with the class mydivclass with prototype js?
With Prototype Js Ajax.updater, I would like to update EVERY div with a specific CLASS but when i do, it does not work for classes.
Element 1
Element 2
function mettreajour(span_id, url_traitement, ...